API Documentation

RouterShift API Overview

RouterShift provides a unified OpenAI-compatible API to access hundreds of AI models from dozens of providers. Use a single API key to route requests intelligently across providers with built-in load balancing, failover, and cost optimization.

Key Features

  • OpenAI-compatible API — drop-in replacement for any OpenAI SDK client
  • Smart routing with configurable strategies (weighted, round-robin, latency-based, failover)
  • Built-in circuit breaker and rate limiting to protect your application
  • Semantic caching to reduce latency and costs on repeated queries
  • Comprehensive logging, monitoring, and spend analytics
  • Multi-provider support with automatic failover when a provider is unavailable

Base URL

All API requests use the following base URL. The API is fully compatible with the OpenAI client libraries — just change the base URL and use your RouterShift API key.

https://api.routershift.com/v1

docs.overview.anthropicBaseUrlTitle

docs.overview.anthropicBaseUrlDesc

docs.overview.anthropicBaseUrl

OpenAI Compatibility

RouterShift is a drop-in replacement for the OpenAI API. If you already use the OpenAI Python or Node.js SDK, you can switch to RouterShift by changing only the base URL and API key. All standard endpoints — chat completions, embeddings, and models listing — work identically.

Supported Model Categories

RouterShift provides access to chat, code generation, vision, image generation, reasoning, and audio models from leading AI providers.

Getting Help

If you encounter issues or have questions, check the sections below for detailed guides. For billing inquiries, contact support through the console. For real-time status updates, visit the Status page.

Full Endpoint List

All API endpoints share a single base URL and authentication method. One API key works across every endpoint.

MethodPathDescription
POST/v1/chat/completionsChat Completions (OpenAI-compatible)
POST/v1/messagesMessages API (Anthropic-compatible)
POST/v1/models/gemini/:model/generateContentGemini Generate Content
POST/v1/models/gemini/:model/streamGenerateContentGemini Stream Generate Content
POST/v1/embeddingsText Embeddings
POST/v1/images/generationsImage Generation
POST/v1/audio/transcriptionsAudio Transcription
POST/v1/audio/speechText to Speech
POST/v1/rerankRerank
POST/v1/midjourney/imagineMidjourney Image Generation
POST/v1/suno/generateSuno Music Generation
POST/v1/batchBatch Processing
POST/v1/chat/completions/asyncAsync Task — Submit
GET/v1/chat/completions/async/:idAsync Task — Check Status
GET/v1/chat/completions/async/:id/resultAsync Task — Get Result
GET/v1/modelsModel Listing

Protocol Correspondence

RouterShift is compatible with multiple API protocols. The table below shows the base URL and SDK configuration for each.

Base URLExample Model ParameterAuth Header
https://api.routershift.com/v1
Standard OpenAI SDK — just change base_url
gpt-4o, claude-sonnet-4-6Authorization: Bearer
docs.overview.anthropicBaseUrl
Standard Anthropic SDK — just change base_url
claude-sonnet-4-6x-api-key: sk-xxx
docs.overview.googleBaseUrl
Gemini native format, call generateContent directly
gemini-2.5-flashAuthorization: Bearer

Unified Authentication

All endpoints use the same authentication. Both header formats work identically:

OpenAI-compatible format

Authorization: Bearer sk-xxx

Anthropic-compatible format

x-api-key: sk-xxx