ai-gateway

Configure unified AI model routing, provider failover, and cost tracking.

2|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/NagyVikt/codex-plugins --skill ai-gateway-nagyvikt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-gateway
Source: https://github.com/NagyVikt/codex-plugins/tree/main/plugins/vercel/skills/ai-gateway
Command: npx skills add https://github.com/NagyVikt/codex-plugins --skill ai-gateway-nagyvikt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai, @ai-sdk/gateway.

What problem does it solve?

This Skill solves the complexity of managing multiple AI providers by providing a single, unified API endpoint that handles model routing, provider failover, and cost attribution.

Core Features & Use Cases

  • Intelligent Routing & Failover: Automatically switch between providers like OpenAI, Anthropic, and Google if one is unavailable or rate-limited.
  • Cost & Usage Tracking: Attribute token usage to specific users or features using tags for granular budget management.
  • Use Case: A production SaaS application can use this to ensure high availability by failing over from GPT-5.4 to Claude-Sonnet-4.6, while simultaneously tracking costs per customer to prevent budget overruns.

Quick Start

Use the ai-gateway skill to configure a model routing chain that prioritizes openai/gpt-5.4 and falls back to anthropic/claude-sonnet-4.6 for a specific user.

Frequently Asked Questions about ai-gateway

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

FAQPage Schema
How do I set up LLM provider failover for my AI application?

LLM provider failover automatically reroutes traffic from an unavailable model to a backup, ensuring high availability. You configure a routing chain that prioritizes a primary provider and falls back to another for specific users.

What is the best way to track AI token costs per user in a SaaS application?

Tracking AI token costs per user requires attributing token usage to specific features using tags. This enables granular budget management and prevents overruns by monitoring consumption per customer.

Can I use Vercel AI Gateway with OIDC-based authentication for production traffic?

Vercel AI Gateway supports OIDC-based authentication for production traffic. It provides a unified API endpoint handling model routing, response caching, and audit logging across multiple LLM providers.

How does unified AI model routing handle rate limits across different providers?

Unified AI model routing handles rate limits by automatically switching between configured providers like OpenAI, Anthropic, and Google. If one provider rate-limits requests, the gateway reroutes traffic to an available fallback model.

Do I need per-user rate limiting for high availability LLM routing?

Per-user rate limiting is required for high availability LLM routing in production-grade applications. It works alongside provider failover and cost tracking to ensure stable performance and prevent budget overruns across users.