Skip to main content

The provider/model Format

When using the OpenAI-compatible endpoints (/v1/chat/completions, /v1/embeddings), specify the model using the provider/model format:
ARouter parses the provider prefix, routes the request to the correct upstream, and rewrites the model field to the provider’s native format before forwarding.

Examples

If you omit the provider prefix, ARouter defaults to OpenAI. So "model": "gpt-5.4" is equivalent to "model": "openai/gpt-5.4".

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:
For example:
  • POST /openai/v1/chat/completions → proxied to OpenAI
  • POST /deepseek/v1/chat/completions → proxied to DeepSeek
  • POST /anthropic/v1/messages → proxied to Anthropic
This is useful when you want to bypass model-field parsing and explicitly control which provider receives the request.

Auto Routing

Set model to "auto" and ARouter will automatically select the best available model for your prompt. No model configuration needed.

How It Works

  1. ARouter’s routing service analyzes your request (prompt complexity, task type, required modalities, etc.)
  2. The optimal model is selected from available healthy providers based on cost efficiency and quality
  3. Your request is forwarded to the selected model
  4. The response includes the model field showing exactly which model was used

Restricting Allowed Models

Use the auto-router plugin to restrict which models auto can select from, using wildcard patterns:
Pattern syntax:
Always check response.model to see which model was actually used.

Code Example

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 messages request 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 model field

Candidate Model Lists

Use the models array together with route when you want ARouter to work through an ordered candidate list.

How It Works

  1. ARouter tries the first model in the list
  2. If it cannot serve the request (provider error, rate limit, key unavailable), it moves to the next
  3. 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 with provider.sort.partition:
Setting 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 a models parameter natively. Use extra_body to pass it:

Assistant Prefill

ARouter supports asking models to complete a partial response. Include a message with role: "assistant" at the end of your messages array to continue from where you left off:
The model will continue from the prefilled assistant message. This technique is useful for:
  • 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.

How Routing Works Under the Hood

ARouter handles provider API key injection, health checking, and failover completely transparently. Your application never sees the upstream provider’s credentials.