ai-gateway

Configure and operate Vercel AI Gateway for model routing, authentication, budgets, and observability.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/sharad07072007/paras --skill ai-gateway-sharad07072007
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-gateway
Source: https://github.com/sharad07072007/paras/tree/main/.agents/plugins/vercel/skills/ai-gateway
Command: npx skills add https://github.com/sharad07072007/paras --skill ai-gateway-sharad07072007

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Routing AI model traffic across multiple providers requires juggling different SDKs, credentials, model IDs, and billing systems. This Skill guides setup and operation of Vercel AI Gateway so requests use correct authentication, live model IDs, routing policies, and spend controls without relying on outdated memorized details. ## Core Features & Use Cases - Setup and Authentication: Configure AI Gateway API keys or Vercel OIDC tokens, migrate existing OpenAI or Anthropic SDK integrations by changing base URLs, and make verified first requests. - Routing and Model Selection: Discover live models via /v1/models, configure provider ordering, model fallbacks, prompt caching, BYOK credentials, and provider timeouts. - Spend and Observability: Manage credits, budgets, and spend alerts through the vercel ai-gateway CLI, debug requests in AI Gateway Logs, and query usage reporting endpoints. - Use Case: A team migrating an OpenAI SDK app points its base URL to https://ai-gateway.vercel.sh/v1, authenticates with an AI Gateway key, sets a monthly budget, and adds a fallback model for resilience. ## Quick Start Ask the assistant to add Vercel AI Gateway to your app and make one verified request using a current model from the live model list.

Frequently Asked Questions about ai-gateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Vercel AI Gateway to an existing OpenAI SDK app?

Keep your OpenAI SDK and point its baseURL to https://ai-gateway.vercel.sh/v1, then replace request authentication with an AI Gateway API key or OIDC token. Model IDs become provider/model strings from the live /v1/models list.

How do I authenticate Vercel AI Gateway requests?

Use an AI Gateway API key stored in AI_GATEWAY_API_KEY for local scripts, CI, and non-Vercel deployments. Use Vercel OIDC tokens for Vercel deployments and linked local projects via vercel link and vercel env pull.

Does AI Gateway support model fallbacks across providers?

Yes, the models array in providerOptions.gateway lists fallback models tried in order when all eligible providers for the primary model fail. Provider ordering and filtering policies apply to each fallback model.

Can I use my own provider API keys with AI Gateway?

Yes, BYOK credentials under providerOptions.gateway.byok authenticate AI Gateway to a provider, but the request still needs an AI Gateway API key or OIDC token. BYOK spend is metered separately and never counts toward budgets.

Why does my AI Gateway request return a 402 error?

A 402 with insufficient_funds means the team has no positive AI Gateway Credits balance, while quota_for_entity_exceeded means a team, project, API key, or user budget is exhausted. Add credits or raise the budget to resolve it.

How do I connect Claude Code to Vercel AI Gateway?

Run vercel ai-gateway coding-agents setup, which configures Claude Code, Codex, OpenCode, and Pi with a preview before writing. Manually, set ANTHROPIC_BASE_URL to the gateway endpoint, leave ANTHROPIC_API_KEY empty, and put the gateway key in ANTHROPIC_AUTH_TOKEN.