Download

How to choose and change models in Codex and Claude Code

AutoRouter9 min read

AutoRouter, the Mac app for all your coding agents, adds models from every leading provider to the picker you already use, plus one more choice that picks a model for each turn. To choose yourself, give each task the smallest model that does it well, and change models with the controls each app already has. In Claude Code and Codex alike, /model switches now, a launch flag sets one session, and a settings file sets every session; other providers' models come in through Claude Code's environment variables or a provider table in Codex's config.toml. This guide covers choosing, changing and adding models in both apps, and links to the detailed guide for each step.

Which model should each coding task get?

Work that spans files, hides its cause or starts from a design belongs on a frontier model, and work you could describe in one sentence belongs on a fast one. The tiers below are grouped from each maker's descriptions as of November 2026, and Which model to use for which coding task explains them in full.

TierAnthropicOpenAIGood for
FrontierClaude Opus 5.5 (Claude Fable 5.2 sits above it)GPT-6.2 AstraMulti-file refactors, hard bugs, UI from a design
StrongClaude Sonnet 5.5GPT-6.2 SolTests, code review, most daily coding
FastClaude Haiku 5.5GPT-6 LunaRenames, commit messages, one-line shell commands

When you are unsure, Anthropic says to start with Claude Opus 5.5 and OpenAI with GPT-6.2 Astra (Anthropic, OpenAI). Claude Code's cost guide says Sonnet handles most coding tasks well, and OpenAI's Codex models page recommends GPT-6.2 Sol for everyday coding and GPT-6.2 Astra for demanding work, such as tracing a bug across services. Where the fast tier stops being good enough is the subject of Does model routing make your results worse?

The tier decides cost as much as quality. As of November 2026, Codex charges 200 credits per million input tokens and 1,000 per million output tokens on GPT-6.2 Astra, 50 and 250 on GPT-6.2 Sol, and 2.5 and 12.5 on GPT-6 Luna, so a token on Astra uses 80 times the credits of a token on Luna (OpenAI). On a ChatGPT plan, that is how fast a model draws down the included usage.

How do you change the model in Claude Code?

Run /model and pick one, which also saves it as your default for new sessions. Claude Code takes its model from, in order, /model, the --model flag, the ANTHROPIC_MODEL variable, the model key in a settings file and the ANTHROPIC_DEFAULT_MODEL variable (Anthropic). Aliases such as opus, sonnet and haiku point to the current model in each family, so /model sonnet keeps working when a new Sonnet ships.

# One session on Sonnet
claude --model sonnet

# Opus while planning, Sonnet while building
claude --model opusplan

For a default, add a model key to ~/.claude/settings.json for all your projects, .claude/settings.json for everyone in a project, or .claude/settings.local.json for you in one project. How to change the model in Claude Code lists every setting and alias, and How Claude Code plan mode works covers which model writes the plan.

How do you change the model in Codex?

Use /model in the CLI or the model and reasoning control under the composer in the ChatGPT desktop app, -m for one run, and the model key in ~/.codex/config.toml for every session (OpenAI). If the app shows a Power slider instead of models, open Advanced to pick one. The ChatGPT desktop app, the Codex CLI and the IDE extension all read the same config.toml; GPT-6.2 Astra and GPT-6.2 Sol run in the app and the CLI, so when the IDE extension shares the file, OpenAI suggests a model every client has, such as gpt-6.1-sol. A profile is a separate file, ~/.codex/<name>.config.toml, that Codex layers over config.toml when you start it with --profile <name> (OpenAI).

# One run on GPT-6.2 Sol
codex -m gpt-6.2-sol

# A quick job on GPT-6 Luna
codex exec -m gpt-6-luna "Write a one-line commit message for the staged changes"

# Start with the settings in ~/.codex/quick.config.toml
codex --profile quick

In Codex 0.134.0 and later, --profile no longer reads [profiles.<name>] tables from config.toml, so guides that show those tables are out of date. Codex model providers and config.toml, explained covers every key, one-off -c overrides and local models with codex --oss.

How do the two apps compare for model settings?

Both apps cover the same jobs with different controls. As of November 2026, from each maker's docs (for plans, prices and features beyond models, see How do Codex and Claude Code compare, and can you use both?):

What you wantClaude CodeCodex
Switch models now/model sonnet, saved as your default/model, or the model and reasoning control under the composer
One session or runclaude --model opuscodex -m gpt-6.2-sol, or codex exec -m for one job
A default for every session"model": "sonnet" in ~/.claude/settings.jsonmodel = "gpt-6.2-sol" in ~/.codex/config.toml
A saved setup for one kind of workA subagent with its own model fieldA profile file loaded with --profile
A separate model for planning or reviewopusplan: Opus to plan, Sonnet to buildreview_model sets the model /review uses
Another provider's modelANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKENA [model_providers.<id>] table that speaks the Responses API
A pick for every turnAutoRouter, chosen with /modelAutoRouter, chosen from the model menu

How do you give subagents and agent teams their own model?

Set the model field in a subagent's frontmatter, or CLAUDE_CODE_SUBAGENT_MODEL for subagents that don't name one. A subagent takes its model from, in order, the model Claude passes when it starts it, its model field, CLAUDE_CODE_SUBAGENT_MODEL and then the main conversation's model, so an Opus session runs Opus subagents unless something says otherwise. Agent teammates follow a similar order, starting with the model your spawn prompt names. How to run multiple agents in Claude Code covers both, including what extra agents cost.

---
name: test-runner
description: Runs the test suite and reports only the failures
model: haiku
---
Run the tests. Return the names of failing tests and their error output, nothing else.

How do you add models from other providers?

Point the app at the provider's endpoint and give it that provider's API key. In Claude Code, set ANTHROPIC_BASE_URL to the provider's Anthropic-compatible endpoint and the key in ANTHROPIC_AUTH_TOKEN (Anthropic). In Codex, add a [model_providers.<id>] table to config.toml with the provider's base URL and the environment variable that holds its key; the provider has to speak OpenAI's Responses API (OpenAI). A gateway such as OpenRouter replaces one key per provider with one key and one balance.

Try a new model in Codex or Claude Code without another API key compares those routes step by step, and Model routers for Claude Code and Codex, compared covers the tools that also pick a model for you. To run your plans in other apps, see How to use Claude Code in Cursor, How to use Codex in Cursor and How to use Codex in Claude Code.

Can a tool pick the model for each turn?

Yes. A model router sits between the app and several models and decides which one handles each request, as What is an LLM router? explains. Cursor and GitHub Copilot build an Auto mode into their own tools, and Cursor Auto mode vs Copilot auto vs AutoRouter compares them. For Codex and Claude Code, both apps let you pick and save models yourself, and you do the sorting.

AutoRouter adds models from every leading provider to the picker of every coding agent you use, with no keys or endpoints to set up, plus one more choice, AutoRouter, which picks a model for each turn. Your own rules decide a turn first; How to write model routing rules in plain English shows how to write them. Otherwise AutoRouter works out how hard the turn is, only considers 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 the order.

Choosing a specific model in the picker sends turns straight to that model instead. AutoRouter works with all your coding agents (Claude Code, Codex, Cursor, etc.) on macOS 14 or later, and it is in beta. Routing across the AI subscriptions you already pay for is free; Pro includes usage each month and adds every other model at the provider's price plus 10%. AutoRouter wrote this guide.

Questions

What is the best model for Claude Code?

It depends on the task. Anthropic's cost guide says Sonnet handles most coding tasks well and keeps Opus for complex architectural decisions and multi-step reasoning, and suggests Haiku for simple subagent tasks. As of November 2026, Claude Code starts on Claude Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and the API, and Claude Fable 5.2 is never the default, so /model sonnet is the first change to try for routine work.

Does changing the model mid-session lose anything?

It can. In Claude Code each model keeps its own prompt cache, so the next request after a switch re-reads the whole conversation with no cache hits, and each plan-mode toggle under opusplan is a switch too. At the terminal, Claude Code asks you to confirm a /model switch while the cache is still warm. Starting a fresh session on the model you want, or running the task in a subagent, avoids the re-read.

Can Codex use a local model?

Yes. codex --oss runs Codex against a local open-source model provider, Ollama or LM Studio, and --local-provider picks one for a single run (OpenAI).

How do I see which model handled a turn?

In Claude Code, /status shows the current model, and a status line can print it on screen; in Codex, /status shows the active model. With AutoRouter selected, every turn shows which model handled it, what it cost and why. How to see which model handled each turn, and what it cost covers the native routes turn by turn.

Sources