What it does
Vercel AI Gateway gives one OpenAI-compatible and Anthropic-compatible endpoint for hundreds of models from OpenAI, Google, Anthropic, Meta, Mistral and others, with fallback between providers. POST JSON to /v1/chat/completions with the key as a Bearer token. Free with a free API key and a monthly included credit for a subset of models, at lower rate limits; Vercel may ask for a payment method before the free credit can be used. Buying credits ends the monthly free credit.
At a glance
- API key
- Needed, free · More APIs with a free key
- Pricing
- Free with a free API key and a monthly included credit for a subset of models, at lower rate limits; Vercel may ask for a payment method before the free credit can be used.
- From the browser
- No, call it from a server
- Formats
- JSON
- Interface
- REST
- Provider
- vercel.com
More information: https://vercel.com/docs/ai-gateway
Is this your service? Show that it is listed
Put this badge on your website or in your README; it links to this page. About the badge
Example request
curl
curl -X POST 'https://ai-gateway.vercel.sh/v1/chat/completions' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"model":"openai/gpt-oss-20b","messages":[{"role":"user","content":"Say hello in one word."}],"max_tokens":20}'
JavaScript
const response = await fetch("https://ai-gateway.vercel.sh/v1/chat/completions", {
method: 'POST',
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({"model":"openai/gpt-oss-20b","messages":[{"role":"user","content":"Say hello in one word."}],"max_tokens":20}),
});
const data = await response.json();
console.log(data);
Python
import requests
response = requests.post(
"https://ai-gateway.vercel.sh/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "openai/gpt-oss-20b",
"messages": [
{
"role": "user",
"content": "Say hello in one word.",
},
],
"max_tokens": 20,
},
timeout=30,
)
print(response.json())
Replace YOUR_API_KEY with your own key. Run the JavaScript on a server, such as Node.js 18 or newer: this API does not accept calls from web pages on other sites.