跪拜 Guibai
← All articles
Artificial Intelligence · VibeCoding · OpenAI

AutoRoute Picks the Right Codex Model So You Stop Burning Tokens on Button States

By 雨夜寻晴天 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Codex accounts now pack multiple models at different price points, but the default workflow is to either waste expensive reasoning on trivial UI tweaks or burn time retrying cheap models on hard bugs. AutoRoute turns that choice into a repeatable rule, cutting token cost and rerun time without surrendering control.

Summary

AutoRoute replaces manual model selection inside Codex with a six-dimensional scoring system that weighs complexity, change scope, reasoning depth, risk, context size, and iteration length. It then recommends a model and one of seven effort levels, keeping the switch command ready but never executing it automatically. Three modes control how assertive it is: suggest-only, manual (current config only), and auto (prepares a new-session command). Two explicit flags — `--run` and `--session` — let a developer apply the recommendation to a fresh session or directly switch the current terminal session by typing `/model` and `/effort`.

Runtime signals feed an adaptive upgrade path: repeated test failures, a spike in changed files, or multi-language scope can raise the score mid-task and trigger a stronger model or higher effort. A lightweight availability probe runs on first use and refreshes every 15 minutes or on each Codex launch via a wrapper script; when the probe is blocked, routing continues with discovered models and marks `probe_status=blocked` instead of failing.

Real routing examples show a button loading state landing on `gpt-5.6-luna` with `low` effort, while a cross-page React state sync bug gets `gpt-5.6-sol` with `high` effort. The tool ships with evaluation scripts for comparing success rate, token spend, retries, and latency, and it accepts a `--workload` flag for explicit workload-type hints.

Takeaways
Six dimensions — complexity, change scope, reasoning demand, risk, context size, iteration length — each scored 0–5 and synthesized into a task level that drives model and effort selection.
Model and reasoning effort are chosen independently; a task can keep the same model and only bump effort, or escalate both when risk and blast radius are high.
Seven effort levels are supported: none, low, medium, high, xhigh, max, ultra. AutoRoute picks the closest level the recommended model actually supports.
Runtime signals like consecutive test failures, retry count, changed-file count, and multi-language scope can trigger an adaptive upgrade to a stronger config mid-task.
Three modes: suggest (recommendation only), manual (recommendation constrained to current model/effort), auto (recommendation plus prepared new-session command).
Two explicit flags — `--run` opens a fresh Codex session with the recommended config; `--session` switches the current terminal session by issuing `/model` and `/effort` directly.
A lightweight model-availability probe runs on first use and every 15 minutes; blocked probes don't break routing — discovered directories are kept and `probe_status=blocked` is surfaced.
A `codex-with-autoroute` wrapper script replaces the system `codex` command and re-probes availability on every launch.
A `~/.codex/autoroute.json` config file sets default mode and cache path; `--workload` accepts explicit workload types (simple, everyday, debugging, architecture, research, long_horizon, high_risk).
Evaluation scripts in the repo measure success rate, total tokens, retries, and time spent so teams can compare routed vs. manual selection on their own tasks.
Conclusions

The core friction isn't model capability — it's decision fatigue. When an account holds several models and the cost gap between them is real, every small task forces a micro-economic choice that most developers skip by either always picking the strongest or always picking the cheapest.

Separating model selection from effort selection acknowledges that reasoning depth and model intelligence are distinct levers. A medium model thinking harder can outperform a strong model thinking shallowly on tasks with moderate complexity but deep dependency chains.

Adaptive upgrading based on runtime failure signals turns the router from a static classifier into a feedback loop. This mirrors how a human colleague would reassess a task after seeing it go sideways, rather than sticking to the initial estimate.

The `--session` flag is a notable workaround for a platform limitation: Skills normally can't touch a running Codex session. By locating the terminal and typing commands into it, AutoRoute sidesteps that restriction without requiring API-level integration.

Concepts & terms
Codex Skill
An installable capability inside OpenAI's Codex agent that extends its behavior. Skills are triggered automatically based on their description matching the user's intent, or explicitly by a command like `$skillname`.
Reasoning effort
A Codex parameter (`/effort`) that controls how many inference steps the model spends thinking before producing output. Higher effort increases token consumption and latency but can improve correctness on tasks requiring multi-step reasoning.
Six-dimensional task scoring
AutoRoute's internal rubric: complexity, scope of changes, reasoning demand, risk, context size, and iteration length, each rated 0–5. The aggregate score maps to a task level that determines model and effort recommendations.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗