Introduction

Overview

Understand the architecture and core concepts of the AI Gateway.

Overview

An AI Gateway is a unified proxy that sits between your application and multiple LLM providers. It provides a single API endpoint compatible with OpenAI's format, letting you switch between providers without changing your code.

Why Use an AI Gateway?

Universal Provider Access

Access 20+ LLM providers through one OpenAI-compatible API. Switch between OpenAI, Anthropic, Google, and others without modifying your application code.

# Same API, different providers
curl https://viprouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'

curl https://viprouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "anthropic/claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello"}]}'

Cost Optimization

  • Automatic fallback: If one provider is down or rate-limited, requests automatically failover to another
  • Load balancing: Distribute requests across multiple providers for better throughput
  • Caching: Semantic caching reduces duplicate API calls

Built-in Features

  • Streaming: Real-time SSE streaming for all providers
  • MCP Tools: Model Context Protocol support for tool-calling agents
  • Governance: Virtual keys, rate limits, budgets, and RBAC
  • Observability: Request logging, metrics, and tracing

Architecture

Your Application
      │
      ▼
┌─────────────────┐
│   AI Gateway    │
│  (Single API)   │
└────────┬────────┘
         │
    ┌────┴────┐
    │ Router  │
    └────┬────┘
         │
   ┌─────┼─────┐
   │     │     │
   ▼     ▼     ▼
OpenAI  Anthropic  Google