
Ai Gateway
Route LLM calls through Vercel AI Gateway with failover, unified provider slugs, and env-based auth while wiring @ai-sdk/gateway in a solo SaaS or agent backend.
Overview
ai-gateway is an agent skill most often used in Build (also Operate, Ship) that configures Vercel AI Gateway model routing, failover, and cost tracking through a unified @ai-sdk/gateway API.
Install
npx skills add https://github.com/vercel/vercel-plugin --skill ai-gatewayWhat is this skill?
- Guides model routing, provider failover, and cost tracking via Vercel AI Gateway unified API
- Validates provider/model slug format (dots in versions, provider/ prefix) and flags outdated model names like gpt-4o
- Recommends OIDC via vercel env pull over manual AI_GATEWAY_API_KEY rotation
- Maps install patterns for npm, pnpm, bun, and yarn with @ai-sdk/gateway
- Points to official AI Gateway and AI SDK Core settings documentation
- 4 embedded validate rules for model slugs, API key pattern, gateway() format, and legacy gpt-4o warning
- 6 bash/import pattern families for package installs and vercel env pull
Adoption & trust: 1 installs on skills.sh; 187 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You need several LLM vendors in one app but keep breaking model slugs, rotating API keys by hand, and lacking a clear failover or cost picture.
Who is it for?
Solo builders deploying AI features on Vercel who want one gateway layer, SDK-native code, and inline guards against outdated model knowledge.
Skip if: Local-only CLIs with no Vercel deployment, teams that refuse network-backed provider routing, or products that need deep custom on-prem inference stacks without Gateway.
When should I use this skill?
Configuring model routing, provider failover, cost tracking, or managing multiple AI providers through Vercel AI Gateway unified API.
What do I get? / Deliverables
After applying the skill, your agent emits Gateway-ready SDK setup, corrected provider/model identifiers, and env workflows aligned with Vercel docs—ready to deploy and monitor spend.
- Gateway client configuration with provider/model strings
- Env pull workflow notes for OIDC vs API key
- Validated SDK snippets free of slug and prefix errors
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Gateway setup and SDK wiring happen during product build when you connect models to your app—not at idea or launch-only steps. Canonical shelf is integrations because the skill centers on @ai-sdk/gateway, provider/model strings, and vercel env pull—not generic frontend or PM work.
Where it fits
Wire gateway('anthropic/claude-sonnet-4.6') in your API route after installing @ai-sdk/gateway.
Compare failover behavior and cost signals before switching primary models in production traffic.
Prefer OIDC token flow from vercel env pull over embedding rotatable AI_GATEWAY_API_KEY in repo templates.
How it compares
Use for Vercel-hosted unified routing and validation—not as a substitute for running raw provider SDKs in every file.
Common Questions / FAQ
Who is ai-gateway for?
Indie and solo builders shipping SaaS or agents on Vercel who configure multiple AI providers through AI Gateway and the Vercel AI SDK.
When should I use ai-gateway?
During build when wiring @ai-sdk/gateway; during operate when tuning failover and cost visibility; during ship when hardening API key handling via vercel env pull instead of long-lived AI_GATEWAY_API_KEY secrets.
Is ai-gateway safe to install?
Review the Security Audits panel on this Prism page and treat any skill that touches API keys and network calls as requiring your own secret-handling policy before use in production.
SKILL.md
READMESKILL.md - Ai Gateway
# Vercel AI Gateway > **CRITICAL —