Skip to content

API Integration Guide

Prerequisite Knowledge: LLM Fundamentals

Overview

Integrating AI into your application starts with choosing the right Model Provider. While there are dozens of options, 95% of production applications today build on top of three core providers: OpenAI, Anthropic, and Google.

This section guides you through connecting these powerful models to your frontend applications.

Provider Comparison Matrix

FeatureOpenAI (GPT-4o)Anthropic (Claude 3.5 Sonnet)Google (Gemini 1.5 Pro)
Best ForGeneral Purpose, Function Calling, Structured DataCoding, Reasoning, Creative WritingLong Context (2M tokens), Multimodal (Video)
Speed⚡️⚡️⚡️⚡️ (Fast)⚡️⚡️⚡️ (Moderate)⚡️⚡️⚡️ (Moderate)
Cost💰💰 (Moderate)💰💰 (Moderate)💰 (Low)
Context Window128k Tokens200k Tokens2M Tokens
Tool UseExcellentExcellentGood
EcosystemMassive (Assistants API, Realtime API)Strong (Artifacts, Computer Use)Growing (Deep Google Integration)

Decision Tree: Which API Should I Use?


Cost Comparison (Estimates)

Prices are per 1 Million Tokens (approx. 750,000 words). Prices subject to change. Last updated: Jan 2026.

ModelInput CostOutput CostTotal for ~1000 requests
GPT-4o$2.50$10.00~$5.00
Claude 3.5 Sonnet$3.00$15.00~$6.00
Gemini 1.5 Pro$1.25$5.00~$2.50
GPT-4o-mini$0.15$0.60~$0.30

Takeaway: For simple tasks (summarization, simple chat), use GPT-4o-mini. It is 20x cheaper than the flagship models.


Detailed Integration Guides

Ready to write code? Follow these specific guides:


Rate Limits & Quotas

When moving to production, you will hit limits.

Common Limits:

  1. RPM (Requests Per Minute): How many API calls you can make.
  2. TPM (Tokens Per Minute): How much text you can send/receive.

Handling Limits:

  • Exponential Backoff: If you get a 429 Too Many Requests, wait 1s, then 2s, then 4s...
  • Tier Upgrades: Most providers increase limits as you spend more (e.g., OpenAI Usage Tiers).
  • Load Balancing: Advanced users rotate keys or providers.

Next Steps

  1. Get an API Key from your chosen provider.
  2. Install the SDK (npm install openai or npm install @anthropic-ai/sdk).
  3. Make your first call following our OpenAI Guide.