Provider Routing
How AICredits routes requests across LLM providers. Explicit routing, heuristic model detection, and automatic failover.
Use this page with an AI assistant
Opens a new chat with this docs URL and the correct AICredits base URLs.
AICredits routes every request to the right upstream provider based on the model ID you specify. This page explains the routing logic and how to control it.
Routing Logic
Explicit Routing
The most reliable way to route is to prefix your model ID with the provider name:
openai/gpt-4o → OpenAI
anthropic/claude-sonnet-4.6 → Anthropic
google/gemini-2.0-flash → Google
deepseek/deepseek-chat → DeepSeek
mistral/mistral-large → Mistral
xai/grok-beta → xAIExplicit routing guarantees the request goes to the provider you specify, with no ambiguity.
Heuristic Routing
If no provider prefix is given, AICredits uses heuristics to detect the provider from the model name:
| Model prefix | Provider |
|---|---|
gpt-, o1-, o3-, text-embedding- | OpenAI |
claude- | Anthropic |
gemini- | |
deepseek- | DeepSeek |
mistral-, mixtral- | Mistral |
grok- | xAI |
| Unknown | Routes to aggregated provider pool |
Using explicit provider/model prefixes is strongly recommended for production workloads. Heuristics can be ambiguous when providers name new models similarly.
Failover
When the primary provider is unavailable (circuit breaker triggered), AICredits automatically retries the request:
- Healthy keys first — round-robin across healthy API keys for the same provider
- Exponential backoff — 500ms, 1s, 2s between retries (max 3 attempts)
- Fallback provider — if all direct provider keys are unhealthy, routes to an aggregated provider pool as last resort
The circuit breaker marks a provider key as unhealthy for 30 seconds after repeated failures, then recovers automatically.
Supported Providers
| Provider | Models | Direct Support |
|---|---|---|
| OpenAI | GPT-4o, GPT-4o-mini, o1, o3, DALL-E 3, TTS, Whisper | Yes |
| Anthropic | Claude Opus 4, Sonnet 4, Haiku 4 | Yes |
| Gemini 2.0 Flash, Gemini 1.5 Pro/Flash | Yes | |
| DeepSeek | DeepSeek Chat, DeepSeek R1 | Yes |
| Mistral | Mistral Large, Small, Nemo | Yes |
| xAI | Grok Beta | Yes |
| Sarvam | Bulbul v2 (TTS), Saarika v2 (STT) | Yes |
| Aggregated pool | 200+ models including open-source | Yes (fallback) |
Model Discovery
To see all available models with their provider prefixes, use the models endpoint:
curl https://api.aicredits.in/api/modelsOr browse Models → for a searchable list with pricing.