Skip to content

The AI Gateway For Developers

Text, image, and video. Route to hundreds of AI models through a centralized interface.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
import { streamText } from 'ai'

const result = streamText({
  model: 'openai/gpt-5.5',
  prompt: 'Why is the sky blue?'
})
andmore

Routing, billing, and observability in one place

Use a single API key and dashboard to access models, track spend, and keep workloads resilient.

One API key, hundreds of models

Unified billing and observability across your entire AI stack, with text, image, and video models.

Diagram of multiple AI models connected by lines to a single unified endpoint, representing seamless access to different models through one gateway.Diagram of multiple AI models connected by lines to a single unified endpoint, representing seamless access to different models through one gateway.

Built-in failovers, better uptime

Automatic fallbacks during provider outages so your app stays up even when a model goes down.

Graphic showing several API and service icons converging into one central AI Gateway node, symbolizing simplified API management and centralized billing.Graphic showing several API and service icons converging into one central AI Gateway node, symbolizing simplified API management and centralized billing.

No markup, just list price

Pay exactly what providers charge with no platform fees.

Circular flowchart with AI provider icons linked in a ring to a central triangle, illustrating automatic failover and high availability during service outages.Circular flowchart with AI provider icons linked in a ring to a central triangle, illustrating automatic failover and high availability during service outages.
Text
Access the latest from every major model lab and provider. Power your AI features all through a single endpoint.

OpenAI

Vercel is a cloud platform for deploying and hosting websites, apps, and serverless functions with speed, scalability, and simplicity. It gives teams one workflow from development to global delivery, so products ship faster while keeping reliability and performance high across every request. With robust developer tooling and seamless integrations, Vercel enables engineering teams to collaborate efficiently and manage code from preview to production. Its edge network and automatic scaling help you serve users globally with minimal latency and maximum uptime, so you can focus on building great products while Vercel handles infrastructure, deployments, and optimizations to ensure a fast, consistent user experience at scale.

Image
Generate and edit with best-in-class image models, no extra setup.

Google

Video
New
Ship production-ready video across a wide range of models with just a prompt.

xAI

Get Started

This quickstart walks you through making your first text generation request with AI Gateway.

Set Up Your Project

Create a new directory and initialize a Node.js project.
Terminal
mkdir ai-text-demo
cd ai-text-demo
pnpm init

Install Dependencies

Install the AI SDK and development dependencies.
Terminal
npm install ai dotenv @types/node tsx typescript

Set Up Your API Key

Go to the AI Gateway API Keys page in your Vercel dashboard and click Create Key to generate a new API Key.

Create a .env.local file and save your API Key.

.env.local
AI_GATEWAY_API_KEY=your_ai_gateway_api_key
Instead of using an API Key, you can use OIDC tokens to authenticate your requests.

Create and Run Your Script

Create an index.ts file.
index.ts
import { streamText } from 'ai';
import 'dotenv/config';
async function main() {
const result = streamText({
model: 'openai/gpt-5.5',
prompt: 'Invent a new holiday and describe its traditions.',
});
for await (const textPart of result.textStream) {
process.stdout.write(textPart);
}
console.log();
console.log('Token usage:', await result.usage);
console.log('Finish reason:', await result.finishReason);
}
main().catch(console.error);

Run your script.

Terminal
pnpm tsx index.ts

You should see the AI model’s response stream to your terminal.

Frequently Asked Questions

Can I try the Gateway for free?

Yes! When you sign up for a Vercel account, you get $5 of credits every 30 days to try out any model from our model list. We don’t restrict access to premium models.

Note: After you make your first payment, you are considered a paid customer and will no longer receive the free credits.

How is the Gateway priced?

We offer tokens at list price from the upstream providers with no markup.

If you bring your own key, we will not add any markup to your token price (0%).

You are responsible for any payment processing fees.

Do you have any rate limits?

While the upstream providers may have limits, Vercel doesn’t place any rate limits on your queries.

We are constantly working with the upstream providers to get you the maximum limits, throughput and reliability.

What models do you support?

We have over a hundred models from a range of providers to give you the maximum flexibility.

See the full model list here.