SDKs & APIs
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
| API | Best for | Documentation |
|---|---|---|
| OpenAI-Compatible | Existing OpenAI integrations, broad language support | Chat, Tools, Embeddings |
| Anthropic-Compatible | Claude Code, Anthropic SDK users | Messages, Tools, Files |
| OpenResponses | New projects, provider-agnostic design | Streaming, Tools, Vision |
| Python | Python developers | Async, 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.
- Get your API key to start making requests
- Browse available models to find the right model for your use case
- Set up observability to monitor usage and debug requests
Was this helpful?