Skip to main content

Vercel AI Gateway

Vercel AI Gateway is available on the Spanway gateway through the vercel_ai_gateway/ model prefix. You register a Vercel AI Gateway model once in the gateway's config.yaml (or through the Admin UI), and every application then calls it through the gateway's OpenAI-compatible API with a Spanway virtual key. The provider credential stays on the gateway, and every request is authenticated, rate limited, logged and costed in the same way as any other provider.

The gateway translates requests and responses for Vercel AI Gateway natively, so provider specific parameters and errors are mapped to the OpenAI format for you.

Supported endpoints​

The gateway's endpoint support matrix lists the following endpoints for Vercel AI Gateway. Each link explains the request shape and the gateway features that apply to that endpoint.

Model types​

The bundled price map lists 99 Vercel AI Gateway models across these modes: Chat, Embedding. The mode decides which gateway endpoint a model is meant for, and it is also used by the gateway's health checks to send the right kind of test request.

Environment variables​

The Vercel AI Gateway integration reads the following environment variables. Variables marked as required are the ones the gateway's environment validation checks for this provider. You can also pass any of these values directly in spanway_params (for example api_key or api_base), and the per-model value wins over the environment.

VariableRequiredPurpose
VERCEL_AI_GATEWAY_API_KEYYesCredential the gateway sends to the provider
VERCEL_AI_GATEWAY_API_BASENoOverrides the provider base URL
VERCEL_OIDC_TOKENNoCredential the gateway sends to the provider

Reference a variable from config.yaml with the os.environ/ prefix so that the secret never appears in the file itself. Secrets can also come from a secret manager, see secret managers.

Register a model on the gateway​

Add an entry to model_list in config.yaml. The model_name is the public name your applications send, and spanway_params.model tells the gateway which provider and upstream model to call.

model_list:
- model_name: gemini-2.5-pro
spanway_params:
model: vercel_ai_gateway/google/gemini-2.5-pro
api_key: os.environ/VERCEL_AI_GATEWAY_API_KEY

Start the gateway with this file:

export VERCEL_AI_GATEWAY_API_KEY="..."
spanway --config config.yaml
Private preview

Spanway is in private preview. The container images and Helm charts will be published soon. To request access, write to sales@spanway.ai, and preview customers receive download instructions in their onboarding pack.

To add the model without a restart, call POST /model/new with the same model_name and spanway_params, or use the Models + Endpoints page in the Admin UI. See model management for details.

Call the model through the gateway​

Send requests to the gateway's /v1/chat/completions endpoint with a virtual key. The gateway maps the public model name to the Vercel AI Gateway deployment, translates the request, and returns the response in the OpenAI format.

curl -X POST http://localhost:4000/v1/chat/completions \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "Summarize what an AI gateway does in two sentences."}]
}'

The same request works from any OpenAI SDK by setting the base URL to http://localhost:4000 and the API key to a Spanway virtual key. Create keys with POST /key/generate as described in virtual keys.

Models and pricing​

The table lists every Vercel AI Gateway model in the gateway's bundled price map. Prices are shown in US dollars per 1 million tokens, computed from the per-token values the gateway uses for spend tracking. Context window sizes are the provider limits recorded in the same file. Capabilities are the supports_* flags set for each model.

info

Prices come from the price map bundled with this Spanway build. They are used to calculate the spend recorded for each request, key, team and user. Your negotiated rates may differ, and you can override them per deployment with custom pricing.

Model (model value)ModeMax input tokensMax output tokensInput per 1M tokensOutput per 1M tokensOther pricingCapabilities
vercel_ai_gateway/alibaba/qwen-3-14bChat40,96016,384$0.08$0.24
vercel_ai_gateway/alibaba/qwen-3-30bChat40,96016,384$0.1$0.3
vercel_ai_gateway/alibaba/qwen-3-32bChat40,96016,384$0.1$0.3tools
vercel_ai_gateway/alibaba/qwen-3-235bChat40,96016,384$0.2$0.6
vercel_ai_gateway/alibaba/qwen3-coderChat262,14466,536$0.4$1.60tools
vercel_ai_gateway/amazon/nova-liteChat300,0008,192$0.06$0.24tools, vision, structured output
vercel_ai_gateway/amazon/nova-microChat128,0008,192$0.035$0.14tools, structured output
vercel_ai_gateway/amazon/nova-proChat300,0008,192$0.8$3.20tools, vision, structured output
vercel_ai_gateway/amazon/titan-embed-text-v2Chat00$0.02$0
vercel_ai_gateway/anthropic/claude-3-5-sonnetChat200,0008,192$3.00$15.00tools, vision, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-3-5-sonnet-20241022Chat200,0008,192$3.00$15.00tools, vision, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-3-7-sonnetChat200,00064,000$3.00$15.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-3-haikuChat200,0004,096$0.25$1.25tools, vision, structured output
vercel_ai_gateway/anthropic/claude-3-opusChat200,0004,096$15.00$75.00tools, vision, structured output
vercel_ai_gateway/anthropic/claude-3.5-haikuChat200,0008,192$0.8$4.00tools, vision, structured output
vercel_ai_gateway/anthropic/claude-3.5-sonnetChat200,0008,192$3.00$15.00tools, vision, structured output
vercel_ai_gateway/anthropic/claude-3.7-sonnetChat200,00064,000$3.00$15.00tools, vision, structured output
vercel_ai_gateway/anthropic/claude-4-opusChat200,00032,000$15.00$75.00tools, vision, structured output
vercel_ai_gateway/anthropic/claude-4-sonnetChat200,00064,000$3.00$15.00tools
vercel_ai_gateway/anthropic/claude-haiku-4.5Chat200,00064,000$1.00$5.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-opus-4Chat200,00032,000$15.00$75.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-opus-4.1Chat200,00032,000$15.00$75.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-opus-4.5Chat200,00064,000$5.00$25.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-opus-4.6Chat200,00064,000$5.00$25.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-sonnet-4Chat200,00064,000$3.00$15.00tools, vision, reasoning, prompt caching, structured output, computer use
vercel_ai_gateway/anthropic/claude-sonnet-4.5Chat1,000,00064,000$3.00$15.00tools, vision, reasoning, prompt caching, computer use
vercel_ai_gateway/cohere/command-aChat256,0008,000$2.50$10.00tools, structured output
vercel_ai_gateway/cohere/command-rChat128,0004,096$0.15$0.6tools
vercel_ai_gateway/cohere/command-r-plusChat128,0004,096$2.50$10.00tools
vercel_ai_gateway/cohere/embed-v4.0Chat00$0.12$0
vercel_ai_gateway/deepseek/deepseek-r1Chat128,0008,192$0.55$2.19
vercel_ai_gateway/deepseek/deepseek-r1-distill-llama-70bChat131,072131,072$0.75$0.99tools, structured output
vercel_ai_gateway/deepseek/deepseek-v3Chat128,0008,192$0.9$0.9
vercel_ai_gateway/google/gemini-2.5-flashChat1,000,00065,536$0.3$2.50tools, vision, reasoning, prompt caching, structured output, web search, PDF input
vercel_ai_gateway/google/gemini-2.5-proChat1,048,57665,536$1.25$10.00tools, vision, reasoning, prompt caching, structured output, web search, PDF input
vercel_ai_gateway/google/gemini-embedding-001Embedding00$0.15$0
vercel_ai_gateway/google/gemma-2-9bChat8,1928,192$0.2$0.2tools, vision
vercel_ai_gateway/google/text-embedding-005Embedding00$0.025$0
vercel_ai_gateway/google/text-multilingual-embedding-002Embedding00$0.025$0
vercel_ai_gateway/inception/mercury-coder-smallChat32,00016,384$0.25$1.00
vercel_ai_gateway/meta/llama-3-8bChat8,1928,192$0.05$0.08
vercel_ai_gateway/meta/llama-3-70bChat8,1928,192$0.59$0.79
vercel_ai_gateway/meta/llama-3.1-8bChat131,000131,072$0.05$0.08tools, structured output
vercel_ai_gateway/meta/llama-3.1-70bChat128,0008,192$0.72$0.72
vercel_ai_gateway/meta/llama-3.2-1bChat128,0008,192$0.1$0.1
vercel_ai_gateway/meta/llama-3.2-3bChat128,0008,192$0.15$0.15tools, structured output
vercel_ai_gateway/meta/llama-3.2-11bChat128,0008,192$0.16$0.16tools, vision
vercel_ai_gateway/meta/llama-3.2-90bChat128,0008,192$0.72$0.72tools, vision
vercel_ai_gateway/meta/llama-3.3-70bChat128,0008,192$0.72$0.72tools
vercel_ai_gateway/meta/llama-4-maverickChat131,0728,192$0.2$0.6
vercel_ai_gateway/meta/llama-4-scoutChat131,0728,192$0.1$0.3tools, vision
vercel_ai_gateway/mistral/codestralChat256,0004,000$0.3$0.9tools
vercel_ai_gateway/mistral/codestral-embedChat00$0.15$0
vercel_ai_gateway/mistral/devstral-smallChat128,000128,000$0.07$0.28tools, structured output
vercel_ai_gateway/mistral/magistral-mediumChat128,00064,000$2.00$5.00tools, structured output
vercel_ai_gateway/mistral/magistral-smallChat128,00064,000$0.5$1.50tools
vercel_ai_gateway/mistral/ministral-3bChat128,0004,000$0.04$0.04tools
vercel_ai_gateway/mistral/ministral-8bChat128,0004,000$0.1$0.1tools, vision
vercel_ai_gateway/mistral/mistral-embedChat00$0.1$0
vercel_ai_gateway/mistral/mistral-largeChat32,0004,000$2.00$6.00tools
vercel_ai_gateway/mistral/mistral-saba-24bChat32,76832,768$0.79$0.79
vercel_ai_gateway/mistral/mistral-smallChat32,0004,000$0.1$0.3tools, structured output
vercel_ai_gateway/mistral/mixtral-8x22b-instructChat65,5362,048$1.20$1.20tools
vercel_ai_gateway/mistral/pixtral-12bChat128,0004,000$0.15$0.15tools, vision, structured output
vercel_ai_gateway/mistral/pixtral-largeChat128,0004,000$2.00$6.00tools, vision, structured output
vercel_ai_gateway/moonshotai/kimi-k2Chat131,07216,384$0.55$2.20tools
vercel_ai_gateway/morph/morph-v3-fastChat32,76816,384$0.8$1.20
vercel_ai_gateway/morph/morph-v3-largeChat32,76816,384$0.9$1.90
vercel_ai_gateway/openai/gpt-3.5-turboChat16,3854,096$0.5$1.50tools
vercel_ai_gateway/openai/gpt-3.5-turbo-instructChat8,1924,096$1.50$2.00
vercel_ai_gateway/openai/gpt-4-turboChat128,0004,096$10.00$30.00tools, vision
vercel_ai_gateway/openai/gpt-4.1Chat1,047,57632,768$2.00$8.00tools, vision, structured output
vercel_ai_gateway/openai/gpt-4.1-miniChat1,047,57632,768$0.4$1.60tools, vision, structured output
vercel_ai_gateway/openai/gpt-4.1-nanoChat1,047,57632,768$0.1$0.4tools, vision, structured output
vercel_ai_gateway/openai/gpt-4oChat128,00016,384$2.50$10.00tools, vision, structured output
vercel_ai_gateway/openai/gpt-4o-miniChat128,00016,384$0.15$0.6tools, vision, structured output
vercel_ai_gateway/openai/o1Chat200,000100,000$15.00$60.00tools, vision, structured output
vercel_ai_gateway/openai/o3Chat200,000100,000$2.00$8.00tools, vision, structured output
vercel_ai_gateway/openai/o3-miniChat200,000100,000$1.10$4.40tools, structured output
vercel_ai_gateway/openai/o4-miniChat200,000100,000$1.10$4.40tools, vision, structured output
vercel_ai_gateway/openai/text-embedding-3-largeEmbedding00$0.13$0
vercel_ai_gateway/openai/text-embedding-3-smallEmbedding00$0.02$0
vercel_ai_gateway/openai/text-embedding-ada-002Embedding00$0.1$0
vercel_ai_gateway/perplexity/sonarChat127,0008,000$1.00$1.00
vercel_ai_gateway/perplexity/sonar-proChat200,0008,000$3.00$15.00
vercel_ai_gateway/perplexity/sonar-reasoningChat127,0008,000$1.00$5.00
vercel_ai_gateway/perplexity/sonar-reasoning-proChat127,0008,000$2.00$8.00
vercel_ai_gateway/vercel/v0-1.0-mdChat128,00032,000$3.00$15.00tools, vision
vercel_ai_gateway/vercel/v0-1.5-mdChat128,00032,768$3.00$15.00tools, vision
vercel_ai_gateway/xai/grok-2Chat131,0724,000$2.00$10.00tools
vercel_ai_gateway/xai/grok-2-visionChat32,76832,768$2.00$10.00tools, vision
vercel_ai_gateway/xai/grok-3Chat131,072131,072$3.00$15.00tools
vercel_ai_gateway/xai/grok-3-fastChat131,072131,072$5.00$25.00tools
vercel_ai_gateway/xai/grok-3-miniChat131,072131,072$0.3$0.5tools
vercel_ai_gateway/xai/grok-3-mini-fastChat131,072131,072$0.6$4.00tools
vercel_ai_gateway/xai/grok-4Chat256,000256,000$3.00$15.00tools
vercel_ai_gateway/zai/glm-4.5Chat131,072131,072$0.6$2.20tools
vercel_ai_gateway/zai/glm-4.5-airChat128,00096,000$0.2$1.10tools
vercel_ai_gateway/zai/glm-4.6Chat200,000200,000$0.45$1.80tools