ai-gateway

Route AI requests across providers with failover and cost tracking.

7|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/Cobalt-Money/Cobalt --skill ai-gateway-cobalt-money
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-gateway
Source: https://github.com/Cobalt-Money/Cobalt/tree/main/.agents/skills/ai-gateway
Command: npx skills add https://github.com/Cobalt-Money/Cobalt --skill ai-gateway-cobalt-money

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 granular cost tracking.

Core Features & Use Cases

  • Intelligent Routing & Failover: Automatically switches to backup providers or models if the primary service experiences downtime or rate limits.
  • Cost Attribution & Budgeting: Tracks token usage per user and feature using custom tags, allowing for precise budget alerts and spend management.
  • Use Case: A multi-tenant SaaS application can use this to route requests across OpenAI and Anthropic, ensuring high availability while enforcing per-user rate limits and monitoring costs by feature.

Quick Start

Configure the AI Gateway to route requests through openai/gpt-5.4 with a fallback to anthropic/claude-sonnet-4.6 for production reliability.

Frequently Asked Questions about ai-gateway

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

FAQPage Schema
How do I handle AI model failover across multiple providers like OpenAI and Anthropic?

AI model failover automatically routes requests to backup providers like Anthropic when primary services like OpenAI experience downtime. This ensures high availability for production AI deployments by abstracting provider-specific SDKs through a unified endpoint.

What is the best way to track LLM API costs per user in a multi-tenant application?

Tracking LLM API costs per user requires custom tags applied to token usage data. This enables precise budget attribution and spend management across features, allowing multi-tenant SaaS applications to monitor consumption and enforce per-user rate limits.

Does the AI gateway require OIDC-based authentication for secure token management?

Yes, OIDC-based authentication is required for secure, zero-maintenance token management. This integration ensures that API requests routed through the Vercel AI SDK remain protected while accessing multiple model providers.

Can I use this with the Vercel AI SDK to enforce per-user rate limits?

Yes, integrating with the Vercel AI SDK allows you to enforce per-user rate limits effectively. The gateway abstracts the underlying provider SDKs, managing routing and throttling to ensure production-grade reliability for your application.

Why do I need an AI gateway instead of calling provider SDKs directly?

You need an AI gateway to avoid managing provider-specific SDKs directly. It provides a unified interface for model routing, automatic failover during outages, and granular cost tracking, which are essential for maintaining production-grade AI deployments.

How do I configure intelligent routing for production AI reliability?

Configure intelligent routing by setting a primary model like openai/gpt-5.4 with a fallback to anthropic/claude-sonnet-4.6. This setup ensures the gateway automatically switches providers during downtime or rate limits, maintaining production reliability.