ai-gateway

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Integrating multiple AI model providers requires juggling separate SDKs, API keys, billing accounts, and failover logic. This Skill guides you through Vercel AI Gateway so you can access models from many providers through one authenticated endpoint with unified routing, spend controls, and request logging. ## Core Features & Use Cases - Setup & Authentication: Configure AI Gateway API keys or Vercel OIDC tokens, migrate existing OpenAI or Anthropic SDK integrations by changing the base URL, and handle BYOK provider credentials correctly. - Model Discovery & Routing: Fetch the live model catalog from /v1/models, choose models by modality, capability, price, or data retention, and configure provider ordering, model fallbacks, prompt caching, and reasoning settings. - Spend Controls & Observability: Set budgets at team, project, API key, or user scope, query credit balances and per-generation costs, and debug requests through AI Gateway Logs. - Use Case: You have an app calling the OpenAI SDK directly. Use this Skill to repoint its base URL to the gateway, pick a current model ID, add a fallback model, and set a monthly budget on the API key. ## Quick Start Ask the agent to add Vercel AI Gateway to your app and make one authenticated test request using a model from the live /v1/models 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 app?

Keep your existing OpenAI or Anthropic SDK and change its base URL to https://ai-gateway.vercel.sh/v1 (OpenAI) or https://ai-gateway.vercel.sh (Anthropic). Then authenticate with an AI Gateway API key or OIDC token and use provider/model IDs from the live /v1/models endpoint.

How do I configure model fallbacks with AI Gateway?

Set providerOptions.gateway.models to an ordered list of fallback model IDs. If all eligible providers for the primary model fail, the gateway tries each fallback in order, and provider ordering rules apply to each model.

What authentication does Vercel AI Gateway use?

Requests authenticate with an AI Gateway API key stored in AI_GATEWAY_API_KEY, or a Vercel OIDC token for deployments and linked local projects. BYOK provider credentials only control how the gateway authenticates to providers and never replace request authentication.

Can I route Claude Code or Codex through AI Gateway?

Yes. Run vercel ai-gateway setup to configure supported coding agents, which provisions a key and previews config changes. Manual setup points the agent at https://ai-gateway.vercel.sh/coding-agent/v1 or a dedicated endpoint like the Claude Code URL.

Why does my AI Gateway request return a 402 error?

A 402 means insufficient funds or an exhausted budget. Check the team's credit balance via GET /v1/credits, and inspect team, project, API key, or user budgets, since any single exhausted budget rejects the request.

Does AI Gateway support budgets and spend tracking?

Yes. Budgets cap metered spend at team, project, API key, or user scope with daily, weekly, or monthly refresh periods. Custom budgets can email spend alerts at 50%, 75%, or 100% thresholds, and BYOK spend is metered separately.