Beta
Download

How to write model routing rules in plain English

AutoRouter7 min read

AutoRouter, the Mac app for Codex and Claude Code, lets you write routing rules in plain English, such as "Use Claude Opus 5.5 for UI work." When one of your rules applies, it decides the turn, and your rules come before AutoRouter's recommended ones. You can see how often each rule is used, and choosing a specific model in the picker sends turns straight to that model instead.

AutoRouter wrote this post, and it describes rules as of October 22, 2026.

How do routing rules work in AutoRouter?

A routing rule is one plain-English sentence that names a kind of work and the model, or kind of model, that should handle it. Rules go first: if one of your rules applies to a turn, that rule decides the turn. AutoRouter's landing page gives this pair as an example: send UI prompts to frontier models, and git commands to a low-cost model.

When none of your rules applies, AutoRouter routes the turn itself. It works out how hard the turn is, considers only the models that clear the quality bar for it, sends hard work to the most capable model your plans cover, and sends everything else to the model that costs you least. How AutoRouter picks a model for each turn walks through that order step by step.

One detail matters when you write a rule. Every model has to clear a quality bar for the task before price counts at all, unless one of your own rules names it, so name a model you have seen do that kind of work well.

Which rules does AutoRouter already follow?

AutoRouter has six built-in rules, so you don't need to write any of these yourself:

A rule that repeats one of these adds nothing. Write your own rules where you want a specific model, or a specific kind of model, for a specific kind of work.

Which routing rules can you copy?

The first three rules in this table come from AutoRouter's landing page. The rest are examples you could write in the same plain-English style, and AutoRouter doesn't ship them as presets. Each one works the same way: when the rule applies, it decides the turn.

SituationRule you could writeWhat it does
UI and front-end work"Use Claude Opus 5.5 for UI work." (landing example)UI turns it applies to go to Claude Opus 5.5.
Code reviews"Prefer GPT-6.1 Sol for code reviews." (landing example)Code review turns it applies to go to GPT-6.1 Sol.
Git commands"Send git commands to a low-cost model." (from the landing's description of rules)Git command turns it applies to go to a low-cost model.
A test that fails only on CI"Use GPT-6 Astra for debugging CI failures."CI debugging turns it applies to go to GPT-6 Astra.
Database migrations"Use Claude Opus 5.5 for database migrations."Migration turns it applies to go to Claude Opus 5.5.
Docs and READMEs"Use Claude Sonnet 5.5 for documentation."Documentation turns it applies to go to Claude Sonnet 5.5.
Trying a pay-per-use model on one kind of work"Use Gemini 4 Argon for writing tests."Test-writing turns it applies to go to Gemini 4 Argon, at the provider's price plus 10%.

A few habits make rules easier to manage:

How do you add a rule and check that it works?

  1. Choose AutoRouter as the model. In Codex, pick it from the model menu under the message box. In Claude Code, run /model and choose AutoRouter.
  2. Write the rule in AutoRouter as one plain-English sentence, such as "Prefer GPT-6.1 Sol for code reviews."
  3. Work as you normally do. Every turn shows its model, what it cost and why.
  4. Check how often each rule is used. If a rule shows no uses after a week of the work it describes, reword it in plainer terms or delete it.
  5. When a turn goes to a model you didn't want, rate the pick, rewrite the rule, or choose a model yourself in the picker.

How is a rule different from Claude Code's /model or a Codex profile?

Claude Code's /model and Codex profiles set which model runs, and it stays until you change it. An AutoRouter rule chooses a model for each turn it applies to, so the model can change from turn to turn within one session as different rules apply.

In Claude Code, as of October 22, 2026, /model switches the model during a session, claude --model sets it at launch, ANTHROPIC_MODEL sets it for the session you start with it, and the model field in a settings file sets a default, in that order of priority (Claude Code: Model configuration). The opusplan alias uses Opus in plan mode and Sonnet for execution, and a custom subagent can set its own model.

In Codex, /model chooses the active model and, when available, its reasoning effort (Slash commands in Codex CLI). A profile is a separate file of settings, such as ~/.codex/deep-review.config.toml, that you load with codex --profile deep-review. Codex 0.134.0 and later ignore the older [profiles.name] tables in config.toml (Codex: Advanced configuration).

# ~/.codex/deep-review.config.toml
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"
MethodWhat you chooseWhere it applies
Claude Code /modelOne modelThe current session, and new sessions if you press Enter
Claude Code opusplanOpus for planning, Sonnet for executionEach phase of a session
Codex /modelOne model and its reasoning effortTurns until you change it
Codex profileA file of settings, including the modelEach launch with --profile
AutoRouter ruleA model, or kind of model, for a kind of workEach turn the rule applies to

Claude Code's and Codex's own settings are the simpler choice when one model suits the whole session, and they need nothing else installed. A rule is worth writing when your sessions mix kinds of work and you already know which model you want for each kind.

Questions

Do my rules come before AutoRouter's own routing?

Yes. Your rules come before AutoRouter's recommended ones, and when one of your rules applies, it decides the turn. When none applies, AutoRouter works out how hard the turn is and routes it on its own.

What happens to my rules when I pick a model in the picker?

Choosing a specific model in the picker sends turns straight to that model, and AutoRouter routes only while it is the model selected. In Claude Code, pressing s in the /model picker switches the model for the current session only and leaves your saved default, such as AutoRouter, unchanged for new sessions (Claude Code: Model configuration).

Can a rule send work to a model that does it badly?

Yes. The quality bar that every model must clear before price counts does not apply to a model your own rule names. Check the model on each turn after you add a rule, rate any pick that falls short, and rewrite the rule if it keeps happening. Does model routing make your results worse? covers where cheaper models fall short.

What does a rule that names a pay-per-use model cost?

Each turn the rule sends there costs the provider's price plus 10%. Pay-per-use models such as Gemini 4 Argon and Kimi K3 come with Pro, which is $20 a month with $20 of included usage each month, and those turns are billed from the included usage first and then from credits you top up. Each turn shows what it cost.

Sources