- Auto (
openrouter/auto) — works like any other model slug; sending it as themodelis all you need to do. - Auto Beta (
openrouter/auto-beta) — the early-access track. New routing behaviors land here before they reachopenrouter/auto. Everything on this page applies to it too, except that per-request settings must use the plugin idauto-beta-routerinstead ofauto-router:
Overview
Instead of manually choosing a model, let the Auto Router analyze your prompt and select a model based on what the OpenRouter community, in aggregate, uses for that kind of work. The router considers factors like task type, model capabilities, tool support, and cost.How It Works
The Auto Router routes on the wisdom of the market: what millions of people, in aggregate, spend on for exactly the kind of task your prompt represents. The rankings are computed from aggregate anonymized spend statistics. Prompts are classified in-flight without requiring retention.- Classify the task. A fast, lightweight classifier assigns each prompt one of ~30 fine-grained task types — for example
code:debugging,agent:multi_step_planning,qa_knowledge,math,customer_support, orresearch_report. - Rank by real-world spend share. For that task type, the router looks up which models the OpenRouter community actually spends on over a trailing 7-day window — the “Share of Spend” view from the task-spend rankings. This is a live signal: when developers migrate a workload to a new model, the router follows within days, with no retraining or manual curation.
- Apply your cost tier. The
cost_tiersetting selects a cost band:low,medium,high,xhigh, ormax. - Route with fallbacks. The top surviving models (in market spend-share order) become the primary pick plus fallbacks, after honoring your account-level model and provider restrictions, guardrails, ZDR policies,
allowed_modelsrestrictions, and output-modality requirements. If classification or rankings are ever unavailable, the router degrades gracefully to a default model set — a request never fails because routing infrastructure hiccuped.
X-OpenRouter-Metadata: enabled header. The router stage in openrouter_metadata.pipeline then carries the tag at data.task_type, such as code:debugging. The field is absent when classification is unavailable.
Usage
Set your model toopenrouter/auto:
Response
The response includes themodel field showing which model was actually used:
Session Stickiness
Unlike a fixed model slug, the Auto Router can pick a different model on every turn. To keep multi-turn conversations coherent, it remembers the model a conversation landed on and prefers it on later turns. OpenRouter recognizes the conversation from an explicitsession_id, or from a fingerprint of your messages if you don’t send one.
The router still ranks candidates from scratch on each turn, and it reuses the remembered model only while that model is still one of the top candidates for the new prompt. When the conversation shifts to a different kind of task, a better-suited model can win instead. The model field in each response tells you which one answered.
Sessions also keep requests on the same provider, which works the same way as it does for any other model. See Provider Sticky Routing for how sessions are identified, how long they last, and how the x-session-id header works.
Example with session_id
Configuring Allowed Models
You can restrict which models the Auto Router can select from using request settings. This is useful when you want to limit routing to specific providers or model families.Via API Request
Use wildcard patterns to filter models. For example,anthropic/* matches all Anthropic models:
Pattern Syntax
When no patterns are configured, the Auto Router considers every ranked candidate for your prompt’s task type.
Excluding Models
Useexcluded_models to prevent the Auto Router from selecting specific models for an individual request. It accepts the same wildcard pattern syntax as allowed_models described above. Exclusions are applied after allowed_models, so an excluded model is never selected even when it matches an allowed pattern.
404 error: No models match your request and model restrictions.
Cost Tier
Use thecost_tier request setting to choose the market’s cost band for routing. The tiers, from cheapest to most capable, are low, medium, high, xhigh, and max. low favors the cheapest capable models, while max favors the most capable models regardless of price. Requests that set no cost setting route as if you had asked for roughly the low band.
Via API Request
cost_quality_tradeoff Deprecated
cost_quality_tradeoff belonged to a previous version of the Auto Router and is deprecated, but remains accepted for backwards compatibility. If both parameters are provided, cost_tier takes precedence.
Account Defaults
Instead of sending these settings on every request, you can save them for your account on your workspace’s Routing page, where the Auto Router section stores allowed models and a cost preference. Saved values apply to every Auto Router request unless that request sets the same field, in which case the request wins — unless you enable the section’s “prevent overrides” toggle, which makes your saved values final. Saved values apply to bothopenrouter/auto and openrouter/auto-beta.
Pricing
You pay the standard rate for whichever model is selected. There is no additional fee for using the Auto Router. To cap what a request may cost,provider.max_price still applies: it filters the endpoints of whichever models the router resolves.
Use Cases
- General-purpose applications: When you don’t know what types of prompts users will send
- Cost optimization: Let the router choose efficient models for simpler tasks
- Quality optimization: Ensure complex prompts get routed to capable models
- Experimentation: Discover which models work best for your use case
Limitations
- The router requires
messagesformat (notprompt) - Streaming is supported
- All standard OpenRouter features (tool calling, etc.) work with the selected model
Related
- Body Builder - Generate multiple parallel API requests
- Latest Model Resolution - Always target the newest version of a model family
- Model Fallbacks - Configure fallback models
- Provider Selection - Control which providers are used