The provider/model Format
When using the OpenAI-compatible endpoints (/v1/chat/completions, /v1/embeddings),
specify the model using the provider/model format:
model field to the provider’s native format before forwarding.
Examples
Native SDK Endpoints
For providers with their own SDK format, use the native endpoints directly. The provider is determined by the endpoint path, not the model field:Native endpoints do not use the
provider/model prefix — they use the provider’s
original model names since the provider is already implied by the endpoint path.Generic Provider Proxy
For any provider, you can also use the catch-all proxy format:POST /openai/v1/chat/completions→ proxied to OpenAIPOST /deepseek/v1/chat/completions→ proxied to DeepSeekPOST /anthropic/v1/messages→ proxied to Anthropic
Auto Routing
Setmodel to "auto" and ARouter will automatically select the best available model for your prompt. No model configuration needed.
How It Works
- ARouter’s routing service analyzes your request (prompt complexity, task type, required modalities, etc.)
- The optimal model is selected from available healthy providers based on cost efficiency and quality
- Your request is forwarded to the selected model
- The response includes the
modelfield showing exactly which model was used
Restricting Allowed Models
Use theauto-router plugin to restrict which models auto can select from, using wildcard patterns:
- TypeScript
- Python
- cURL
response.model to see which model was actually used.
Code Example
- Python (OpenAI)
- Node.js (OpenAI)
- Go
- cURL
Use Cases
- General-purpose apps — When you don’t know what types of prompts users will send
- Cost optimization — Let ARouter route simpler tasks to efficient models automatically
- Zero-config prototyping — Get started without choosing a specific model
- Adaptive routing — Let ARouter choose first, and switch to ordered candidate lists only when you need explicit control
Limitations
- Auto routing uses the standard
messagesrequest format - Auto routing selects from models available to your account
- Streaming is fully supported with
"model": "auto" - You pay the normal rate for the model ARouter selects; there is no additional routing fee
- The selected model is always reflected in the response
modelfield
Candidate Model Lists
Use themodels array together with route when you want ARouter to work through an ordered candidate list.
How It Works
- ARouter tries the first model in the list
- If it cannot serve the request (provider error, rate limit, key unavailable), it moves to the next
- If all models fail, ARouter returns an error with the last failure reason
Routing Behavior
Controlling Partition Behavior
By default, when using a candidate list, endpoints are grouped by model — the first model’s endpoints are always tried before the second model’s. You can change this withprovider.sort.partition:
partition: "none" sorts endpoints globally across all candidate models — useful when you want whichever model is currently fastest, regardless of which is listed first. See Provider Routing for the full reference.
Using Candidate Lists with the OpenAI SDK
The OpenAI SDK doesn’t have amodels parameter natively. Use extra_body to pass it:
- Python (OpenAI)
- Node.js (OpenAI)
- cURL
Assistant Prefill
ARouter supports asking models to complete a partial response. Include a message withrole: "assistant" at the end of your messages array to continue from where you left off:
- Forcing a specific output format
- Resuming multi-turn completions
- Guiding the model into a specific response structure
Not all models support assistant prefill. Anthropic Claude and most open-source models support it. OpenAI models have limited support.