Documentation
Everything you need to integrate with the AllRoutes.ai API Gateway.
Quick Start
# Use any OpenAI-compatible SDK — just change the base URL
curl https://api.allroutes.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'AllRoutes.ai is fully OpenAI-compatible. Replace your base URL and you're set.
Getting Started
API Reference
Chat Completions
Complete reference for the POST /v1/chat/completions endpoint, including all parameters, streaming, and AllRoutes-specific extensions.
Embeddings
Create vector embeddings using the POST /v1/embeddings endpoint.
Models
List, search, and compare available AI models via the Models API.
API Keys
Programmatically create, list, update, and delete API keys.
Billing & Credits
Manage your credit balance, view transactions, and understand AllRoutes pricing.
Streaming
Server-Sent Events protocol for chat completions, including chunk format, [DONE] handling, and stream_options.include_usage.
Rerank
Re-rank a list of documents against a query using Cohere, Voyage, Jina, or Mixedbread reranker models.
Fine-Tuning
Create, monitor, and deploy fine-tuned models across OpenAI, Together, Fireworks, and other supported providers.
Audio (TTS, STT, Translation)
Text-to-speech, speech-to-text, and audio translation across OpenAI, ElevenLabs, Deepgram, and Cartesia.
Images
Generate, edit, and create variations of images via DALL-E, Stable Diffusion, Flux, Imagen, and Ideogram models.
Files
Upload, list, download, and delete files used for fine-tuning, batch jobs, file-parser plugin, and assistants.
Realtime API
WebSocket-based bidirectional streaming for low-latency voice agents and live conversational AI.
Responses API
OpenAI's stateful conversation endpoint with built-in tool execution and conversation persistence.
Features
Smart Routing
Automatic model selection, fallback chains, and provider routing strategies.
Semantic Caching
3-tier caching system that saves 40-80% on repeated queries with exact match, semantic similarity, and provider passthrough.
Guardrails & Compliance
Budget limits, PII redaction, prompt injection detection, and compliance profiles for enterprise-grade AI safety.
Plugins
Extend AllRoutes requests with web search, file parsing, response healing, and more.
Presets
Named configurations for model, parameters, system prompts, and plugins that can be referenced by name in any request.
Broadcast & Observability
Send AI traces and logs to 15+ observability destinations including Datadog, Langfuse, and custom webhooks.
Analytics
Built-in dashboards for cost, latency, quality, and usage breakdowns by model, key, user, and session.
Webhooks
Subscribe to events: request completed, error, budget alert, key created, fine-tuning job done, and more.
Model Groups
Alias multiple concrete models behind a single virtual identifier with weighted routing, fallbacks, and per-group cost controls.
Free Tier
Free models, daily limits, and how community-hosted free routes work alongside paid tiers.
SDKs
Python SDK
Planned Python SDK for AllRoutes. Until it ships, use the OpenAI Python client pointed at https://api.allroutes.ai/v1.
Node.js / TypeScript SDK
Planned Node SDK for AllRoutes. Until it ships, use the OpenAI Node client pointed at https://api.allroutes.ai/v1.
Go SDK
Planned Go SDK for AllRoutes. Until it ships, use any OpenAI-compatible Go client pointed at https://api.allroutes.ai/v1.
Guides
Migrating from OpenRouter
Step-by-step guide to switching from OpenRouter to AllRoutes with a feature comparison and pricing advantages.
Bring Your Own Key (BYOK)
Connect your own provider API keys for 9 providers with 0% commission, automatic validation, and seamless fallback.
Self-Hosted Models
Connect Ollama, vLLM, TGI, or any OpenAI-compatible endpoint to AllRoutes for unified routing, caching, and observability.
OpenAI SDK Drop-in
Reuse the official OpenAI SDKs (Python, Node, Go, Java, etc.) with AllRoutes by changing only the base URL and API key.
Error Handling
Production patterns for catching, retrying, and recovering from AllRoutes API errors -- with typed examples for every SDK.
Cost Optimization
Patterns and AllRoutes features that compound to cut your AI bill 40-90% without quality loss.
Observability Setup
Wire AllRoutes to OpenTelemetry, Langfuse, Helicone, and Datadog for end-to-end tracing of every AI request.