Models

Choosing a Claude model for Claude Code and API work

How to switch models in Claude Code, when a bigger model saves time, how to keep cost down, and how to test two models fairly.

By Laner Labs Learning teamPublished 5 min read

The friendly Laner helper

In Claude Code, switch models with the /model command. In your own API code, change the model ID in the request. The harder part is deciding which one to use. This article covers the switching steps from Claude Code's documentation, when a bigger model is worth it, how Anthropic suggests keeping cost under control, and a simple way to test two models on your own task. Details are as of 23 November 2026. Versions, defaults and plans change, so check the docs for your version.

How to switch models in Claude Code

Claude Code's model configuration page lists several ways to set a model, in order of priority.

  1. During a session: type /model followed by an alias or name to switch immediately, or type /model alone to open the picker.
  2. At startup: launch with claude --model followed by an alias or name.
  3. With an environment variable: set ANTHROPIC_MODEL.
  4. In a settings file: use the model field.
  5. As a default for new sessions: set ANTHROPIC_DEFAULT_MODEL.

The documentation lists these aliases: default, best, fable, sonnet, opus, haiku, and opusplan. On the Anthropic API, as of this date, sonnet resolves to Sonnet 5.5, opus to Opus 5.5 and haiku to Haiku 5.5. The documentation notes that on some other providers these aliases can point to earlier versions. It also says aliases point to the recommended version and update over time. To pin one version, use the full name such as claude-opus-5-5.

Two more notes from the docs. First, the picker has a "this session only" option, so you can try a model without changing your saved default. Second, newer models need a recent Claude Code version. The page names minimum versions for Sonnet 5.5, Opus 5.5 and Haiku 5.5, and suggests running claude update if a request for a model fails.

One more alias is worth knowing. The docs describe opusplan as a mode that uses Opus while planning and then switches to Sonnet for execution. It is a ready-made version of "think big, then work cheaply".

When a bigger model saves time

A smaller model is cheaper per request, but time is also a cost. Here are the cases where moving up tends to pay off, based on how Anthropic describes the models.

  • Large or multi-step work. Anthropic describes Opus 5.5 as built for long-running agentic coding and knowledge work, such as large refactors.
  • Ambiguous problems. Claude Code's docs say Fable models suit root-cause investigations, outage debugging and architecture decisions, and sustain long autonomous sessions. Fable use can bill to usage credits depending on your plan, so read the docs first.
  • Repeated failure. If a smaller model has missed the same thing twice, a larger one may be faster than a third attempt.

The cost guide offers a rule of thumb: Sonnet handles most coding tasks well and costs less than Opus, and Opus is better reserved for complex architectural decisions or multi-step reasoning. Treat that as a starting point and verify on your own code.

Effort before model

Claude Code also has an effort setting, set with /effort, the /model picker or the --effort flag. The docs describe levels from low to max and say lower effort is faster and cheaper for straightforward tasks, while higher effort gives deeper reasoning on hard ones. Anthropic's choosing-a-model page says tuning effort is often a better lever than switching models. So for a small change, try a lower effort. For a tricky bug, try a higher one before you change model. The docs warn that max can show diminishing returns, so test before using it widely. Note that you cannot turn thinking off on Opus 5.5, Sonnet 5.5 or Haiku 5.5, per the cost page.

Keeping cost under control

Claude Code charges by token use on API plans, and costs vary by codebase size and habits. The official cost guide suggests these steps.

  1. Check usage with /usage so you see which models used the tokens.
  2. Clear context between unrelated tasks, so old conversation is not sent again.
  3. Match the model to the job. Do not leave your most expensive model as the default for simple work. The guide says unexpectedly high spend often traces back to long sessions never cleared or to Opus left as the default.
  4. Lower the effort level for simple tasks.
  5. For simple subagent tasks, set a smaller model such as haiku in the subagent configuration. A /model switch can also apply to subagents that inherit the session's model, so check before you delegate.
  6. Write specific prompts, so the model does not have to search widely.

In the API, Anthropic's overview notes that Batch API requests are listed at a discount and that prompt cache reads cost less than normal input. Read the pricing page for the exact rules, because they differ by model and change. We do not repeat numbers here.

How to test two models on your own task

Anthropic's guide says a good evaluation set is the most important step. You can start small.

  1. Pick the task. Choose one real job, such as fixing a type of bug or classifying support messages.
  2. Collect five to ten real examples, including one hard case. Remove private data.
  3. Write down how you will judge the result. For code, that might be "tests pass and the diff is small". For text, it might be a short checklist.
  4. Run model A on every example with the same prompt. Then run model B with the same prompt. Change only the model.
  5. Record the result, the time it took and the usage. In Claude Code, /usage shows tokens by model. In the API, the response reports usage.
  6. Compare. Is B enough better to justify the extra cost or wait? If not, keep A.
  7. Repeat after a model change, because a new version may behave differently.

Keep the prompt, tools and settings identical across runs, including effort. Otherwise you will not know whether the model or the setting made the difference. Anthropic's guide says to test with your actual prompts and data and to compare accuracy, response quality and handling of edge cases.

A sensible default routine

  • Pick a model for daily work and pin it by full name if stability matters.
  • Use a smaller model for simple, repeated jobs and subagents.
  • Move up for large, ambiguous or repeatedly failing tasks, then move back down.
  • Check /usage now and then.
  • Re-read the docs when a new model arrives. Defaults and aliases change.

Official pages for this article: Claude Code model configuration at https://code.claude.com/docs/en/model-config, the Claude Code cost guide at https://code.claude.com/docs/en/costs, and the choosing-a-model guide at https://platform.claude.com/docs/en/about-claude/models/choosing-a-model. Features and plans change and can differ by plan and provider, so confirm there before you rely on any detail here.

Common questions

How do I change the model in Claude Code?

Type /model during a session to open a picker, or /model followed by an alias or name to switch straight away. You can also start with claude --model followed by an alias or name. Claude Code's documentation lists further options, such as an environment variable and a settings file. Check the current docs for your version.

Does a bigger model always save time in Claude Code?

Not always. It can save time on large or ambiguous tasks where a smaller model keeps getting things wrong. On small, clear tasks it may only add cost. Compare the two on a real task before you decide.

How do I stop costs creeping up?

Anthropic's Claude Code cost guide suggests matching the model to the job, clearing context between unrelated tasks, lowering the effort level for simple work, and using a smaller model for simple subagent tasks. Use the /usage command to see where tokens go.

Official pages to check

AI tools change quickly. Check the vendor's current help page before you act, and review anything an AI tool produces before you rely on it.

Share this article