Skip to main content
Vercel AI Gateway provides a unified interface to route requests to various AI providers with free monthly credits.

Overview

Vercel AI Gateway acts as a single endpoint that routes your AI requests to various supported providers, offering features like caching, rate limiting, and observability.

Rate Limits

Monthly Credits: $5/month in free credits
View detailed pricing

Supported Providers

Vercel AI Gateway can route to multiple AI providers:

OpenAI

GPT models and embeddings

Anthropic

Claude models

Google

Gemini models

Mistral

Mistral models

Cohere

Command models

Groq

Fast inference models

API Usage

import openai

client = openai.OpenAI(
    base_url="https://gateway.ai.cloudflare.com/v1/YOUR_ACCOUNT_ID/YOUR_GATEWAY/openai",
    api_key="YOUR_OPENAI_API_KEY"
)

response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "user", "content": "Hello, how are you?"}
    ]
)

print(response.choices[0].message.content)

Getting Started

1

Create Vercel Account

Sign up at vercel.com
2

Create AI Gateway

Set up a new AI Gateway from your dashboard
3

Configure Providers

Add API keys for the providers you want to use
4

Update Endpoint

Point your AI requests to the gateway endpoint

Key Features

Unified Interface

Single endpoint for multiple providers

Caching

Cache responses to reduce costs

Rate Limiting

Control request rates across providers

Observability

Monitor usage and performance

Fallbacks

Automatic failover between providers

Cost Tracking

Track spending across providers

Use Cases

  • Multi-Provider Apps: Use different models for different tasks
  • Cost Optimization: Cache responses and track spending
  • Reliability: Implement failover strategies
  • Development: Test different providers easily
  • Rate Limiting: Protect your applications from overuse

Benefits

  • No need to manage multiple SDKs
  • Built-in caching reduces API costs
  • Centralized observability and analytics
  • Easy provider switching without code changes
  • Automatic rate limiting and quota management

Additional Resources

Vercel Dashboard

Manage your AI Gateway

Documentation

Official documentation

Pricing

Detailed pricing information

Supported Providers

View all supported providers

Build docs developers (and LLMs) love