Menu

SDKs & APIs

Last updated January 21, 2026

AI Gateway provides drop-in compatible APIs that let you switch by changing a base URL. No code rewrites required. Use the same SDKs and tools you already know, with access to 200+ models from every major provider.

Point your existing SDK to the gateway:

import OpenAI from 'openai';
 
const client = new OpenAI({
  apiKey: process.env.AI_GATEWAY_API_KEY,
  baseURL: 'https://ai-gateway.vercel.sh/v1',
});
 
const response = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-4.5', // Any available model
  messages: [{ role: 'user', content: 'Hello!' }],
});
import Anthropic from '@anthropic-ai/sdk';
 
const client = new Anthropic({
  apiKey: process.env.AI_GATEWAY_API_KEY,
  baseURL: 'https://ai-gateway.vercel.sh',
});
 
const message = await client.messages.create({
  model: 'anthropic/claude-sonnet-4.5',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello!' }],
});
curl https://ai-gateway.vercel.sh/v1/chat/completions \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4.5",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
  • No vendor lock-in: Switch between Claude, GPT, Gemini, and other models without changing your code
  • Unified billing: One invoice for all providers instead of managing multiple accounts
  • Built-in fallbacks: Automatic retry with alternative providers if one fails
  • Streaming support: Real-time responses with SSE across all compatible endpoints
  • Full feature parity: Tool calling, structured outputs, vision, and embeddings work exactly as documented
APIBest forDocumentation
OpenAI-CompatibleExisting OpenAI integrations, broad language supportChat, Tools, Embeddings
Anthropic-CompatibleClaude Code, Anthropic SDK usersMessages, Tools, Files
OpenResponsesNew projects, provider-agnostic designStreaming, Tools, Vision
PythonPython developersAsync, Streaming, Frameworks

Already using OpenAI? Use the OpenAI-Compatible API. Change your base URL and you're done.

Using Claude Code or Anthropic SDK? Use the Anthropic-Compatible API for native feature support.

Starting fresh? Consider the OpenResponses API for a modern, provider-agnostic interface, or AI SDK for the best TypeScript experience.


Was this helpful?

supported.