Appearance

Language

Mastering AI agents

How to Set Subagent Models in Claude Code and Codex: What 15 Billion Tokens a Month Taught Me (2026)

My real 30-day Claude Code token usage, which models the subagents ran on and what that would cost at API prices; plus how Claude Code and Codex set a subagent's model, and both vendors' model tiers and official prices.

Kelvin Wang · · 10 min read

Key points

  1. Claude Code on this Mac used about 15 billion tokens in 30 days, 47% of them in subagents; subagent tokens were 66% Opus, 25% Haiku and 9% Sonnet.
  2. Claude Code: write model: haiku in the subagent file. Codex: write model in a TOML file under .codex/agents/, or set a default in config.toml.
  3. My split: the main session dispatches, decides and writes the final report; research and crawling go to subagents running Sonnet and Haiku.
  4. More subagents means more tokens. Splitting cuts the unit price, not the total; check what you actually use with /usage or /status first.

Claude Code on this Mac used about 15 billion tokens in the last 30 days (2026-10-18 to 11-17, all projects), and nearly half of that (47%, about 7.07 billion) was subagents. I got this by adding up the local transcripts:

Where Claude Code's tokens went in the last 30 days billion tokens; summed from local transcripts, 2026-10-18 to 11-17 (Fable under 0.03 billion in total, left out)
  • Main session (Opus) 7.88
  • Subagents (Opus) 4.67
  • Subagents (Haiku) 1.76
  • Subagents (Sonnet) 0.63

The numbers are huge because more than 90% is cache reads: every turn rereads what came before. Opus is the biggest subagent share because the writing and review subagents run on the stronger model; research and crawling, about a third, went to Haiku and Sonnet. At official API prices that third comes to roughly US$236; the same tokens on Opus would be roughly US$1,500, more than six times as much. I’m on subscriptions and don’t actually pay these amounts, and the cache-write surcharge and Haiku’s higher long-prompt price are left out, but the ratio shows what the split saves.

ccusage weekly shows how much went into each week. The biggest so far is the week of 11/8: 5.69 billion tokens, US$2,147 at API prices. The week of 11/15 was only 2.5 days old at export, so its dotted outline is that pace pushed to the end of the week:

Claude Code tokens per week billion tokens per week; local ccusage weekly, exported 2026-11-17 11:40 Taipei time (no use in the weeks of 8/2 and 8/9); the last week's dotted outline is a projection
Projected 9.64
Claude Code API-equivalent cost per week US$ per week; ccusage prices tokens at official API rates. I'm on subscriptions, so this isn't what I pay; the last week's dotted outline is a projection
  • Opus 5.5
  • Opus 5
  • Fable 5.1
  • Sonnet 5.5
  • Haiku 5.5
Projected 2,571
Go deeper How to Check Claude Code Token Usage: Full Tutorial with ccusage and Python (2026) How these two charts were made: the ccusage commands and the Python that turns its JSON into chart data.

How to send work to different models: in Claude Code you add one line, model: haiku, to the subagent’s definition file (it also takes sonnet, opus, a full model ID or inherit). In Codex you write model = "..." in a TOML file under .codex/agents/, or set a default for every subagent in the [agents] table of config.toml. Docs and prices below were checked on November 17, 2026.

What is a multi-model workflow, and why not run everything on the strongest model?

It means running different jobs on different tiers of model. Work that needs judgement, trade-offs or the final version goes to the strongest model. Work that reads a lot of pages and sorts a lot of data, but where no single step is hard, goes to a cheap, fast one.

Both vendors’ docs recommend this:

  • Claude Code. The cost guide says Sonnet handles most coding tasks well and costs less than Opus; keep Opus for complex architectural decisions and multi-step reasoning, and set model: haiku for simple subagent tasks2. The subagent guide lists routing work to faster, cheaper models like Haiku as one of the main reasons to define subagents1.
  • Codex. The subagent guide suggests GPT-6 Luna for fast, narrow, high-volume work and starting demanding agents on GPT-6.1 Sol4.

You can run everything on the top model. But research pulls large amounts of web pages and files into context, which can easily add up to tens of millions of tokens a month, and when unit prices differ by tens of times, so does the bill or the share of your plan. The results come back to the main session anyway, where the strong model decides what to use.

How do I split the work?

I use both Claude Code and Codex. On the Claude Code side, the split came from a few rules:

  • Research always goes to subagents. A rule I set on November 7, 2026: looking things up, fact-checking, keyword research and article research go to subagents; the main session keeps dispatching, decisions and the final report. Research dumped into the main session fills its context, and I wait a long time before I see progress.
  • Sonnet for research, a stronger model for writing. On November 9, when I had a batch of article drafts prepared, I asked for subagents to research on Sonnet and write on Opus.
  • Haiku for large numbers of small jobs. On October 24, to collect data on every exchange covered on the site, I had it send out a batch of Haiku subagents, each running one small plan.
  • A strong model for checking. After a site article is written and polished, it gets two separate Opus review rounds before it reaches me. I read every post and decide whether it goes out.

As a table:

WorkGoes toWhy
Setting direction, splitting work, the final reportMain session (strongest model)Needs the whole picture and trade-offs
Reading official docs, compiling numbers, many web pagesSubagent (Sonnet)Has to understand content, not make the final call
Repetitive small tasks, crawling, item-by-item collectionSubagent (Haiku)High volume, simple steps
Writing, checking, reviewA stronger modelThis step decides the quality

That split is on the Claude Code side, where I pair Sonnet with Haiku. In Codex I generally don’t set a model for subagents and leave it on the default.

Handing research to a cheap model only works if the main session can check what comes back, so when I dispatch research I state that numbers come from official sources only. On November 16, when eight calculator tools for the site were split across several agents working at once, the shared spec had exactly that rule.

Go deeper What Is an AI Harness? 7 Parts That Keep AI Agents Reliable (2026) Subagents are part six of a harness, alongside rules, tests, skills, MCP, memory and verification.

How do Claude and OpenAI models line up by tier?

Both have roughly three tiers. Official API prices, in US$ per million tokens:

TierAnthropicInput / cache hit / outputOpenAIInput / cache hit / output
TopClaude Opus 5.54 / 0.20 / 20GPT-6 Astra10 / 1 / 50
MiddleClaude Sonnet 5.52 / 0.10 / 10GPT-6.1 Sol2 / 0.10 / 10
Lower middle——GPT-6.1 Terra1 / 0.05 / 5
CheapestClaude Haiku 5.50.10 / 0.01 / 0.50GPT-6 Luna0.10 / 0.01 / 0.50

Checked 2026-11-17 on Anthropic's pricing page [3] and OpenAI's API pricing page [5]. Haiku 5.5 prices are for prompts up to 100K tokens; above that they rise to 0.50 / 0.05 / 2.50. OpenAI prices are the standard tier for inputs up to 272K tokens. Both vendors' Batch APIs are half price. Anthropic also has a higher tier, Fable 5.2 (8 / 0.20 / 40).

What to watch for in the table:

  • The middle tiers cost the same. Sonnet 5.5 and GPT-6.1 Sol are both US$2 in and US$10 out.
  • The top tiers differ the most. Opus 5.5 output is US$20, GPT-6 Astra’s is US$50, and cache hits differ fivefold.
  • Long Haiku prompts cost more. A subagent that keeps reading files easily passes 100K tokens in one prompt, and then the unit price is five times higher.
  • Subscriptions are not billed by this table. Signed in with a Claude or ChatGPT plan, subagents draw on the plan’s allowance instead of per-token billing, but that allowance is still consumed by tokens.

How do you set a subagent’s model in Claude Code?

A subagent is a Markdown file in the project’s .claude/agents/ or your personal ~/.claude/agents/. The model goes in the frontmatter model field1:

---
name: researcher
description: Reads official docs and compiles numbers, with a source URL for each. Use for research tasks.
tools: Read, Grep, Glob, WebFetch, WebSearch
model: haiku
---

You do research. Use official sources only, and give the URL and the date checked for every number.
Return only conclusions and the source list, not whole pages.

Values model accepts1:

  • An alias: sonnet, opus, haiku or fable, mapped to the current version.
  • A full model ID: such as claude-opus-5-5. Use it to pin a version instead of following the alias.
  • inherit: the same model as the main session.

Without a model field, a subagent runs on the same model as the conversation that starts it1. So when you switch the main session to Opus, every subagent without its own model switches to Opus too2.

When several places set a model, Claude Code uses the first in this order1:

  1. The model parameter passed at launch. Claude can name an alias when it starts a subagent; saying “send Haiku to look this up” in the conversation goes through here.
  2. The model field in the definition file, including inherit.
  3. The CLAUDE_CODE_SUBAGENT_MODEL environment variable.
  4. The main session’s model.

To put every subagent on one model, set CLAUDE_CODE_SUBAGENT_MODEL together with CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1. While forcing is on, both the definition files’ model and any model named at launch are ignored1.

The built-in subagents have rules of their own. To make codebase exploration cheaper, the docs suggest defining your own subagent named Explore with model: haiku; it overrides the built-in one1.

How do you set a subagent’s model in Codex?

Current Codex releases have subagents on by default, in the desktop app, the CLI and the IDE extension4. There are three places to set the model:

  1. One TOML file per role. Personal ones go in ~/.codex/agents/<name>.toml, project ones in .codex/agents/<name>.toml; each needs name, description and developer_instructions4.
  2. Defaults under [agents] in config.toml. default_subagent_model and default_subagent_reasoning_effort apply to every spawned agent4.
  3. Saying it when you dispatch. Name the model or reasoning effort in the prompt4.
# .codex/agents/researcher.toml
name = "researcher"
description = "Reads official docs and compiles numbers, with a source URL for each."
model = "gpt-6-luna"
model_reasoning_effort = "medium"
developer_instructions = """
Use official sources only, and give the URL and the date checked for every number.
Do not edit files.
"""
# ~/.codex/config.toml
[agents]
max_concurrent_threads_per_session = 4
default_subagent_model = "gpt-6-luna"

Two things to watch4:

  • A role file that sets only model keeps the reasoning effort Codex already resolved. For a different effort, set model_reasoning_effort in the same file.
  • Role files can’t override sandbox_mode, approval_policy, model_provider or mcp_servers. Those always match the parent session.

How do you estimate the cost of a multi-model workflow from usage?

An API bill depends on three numbers: input tokens, the share of them served from cache, and output tokens:

monthly cost = uncached input × input price
             + cached input × cache price
             + output × output price

A research workload as an example: say subagents read 30 million tokens a month, 80% of them cache hits (an agent resends earlier context every turn), and write 600K tokens of output. The same volume on each model:

API cost of the same research workload US$ a month; 30M input tokens a month (80% cache hits), 600K output; official prices on 2026-11-17
  • Claude Opus 5.5 40.8
  • Claude Sonnet 5.5 20.4
  • Claude Haiku 5.5 1.14
  • GPT-6 Astra 114
  • GPT-6.1 Sol 20.4
  • GPT-6.1 Terra 10.2
  • GPT-6 Luna 1.14

Source: claude.com, openai.com

Sonnet 5.5 worked through: 6M uncached × 2 = US$12, 24M cached × 0.10 = US$2.40, 600K output × 10 = US$6, total US$20.40. This leaves out the cache-write fee Anthropic charges on top, so a real bill runs a little higher.

  • The cheapest tier is about 18 times cheaper than the middle one. Haiku 5.5 and GPT-6 Luna are both US$1.14; Sonnet 5.5 and GPT-6.1 Sol are both US$20.40.
  • The middle and top tiers are 2 to 6 times apart. Opus 5.5 is twice Sonnet; GPT-6 Astra is 5.6 times Sol.
  • If Haiku prompts pass 100K tokens, the same volume costs US$5.70, still far below the middle tier.

To plug in your own numbers, the AI subscription vs API cost calculator opens with this usage filled in, converts every model’s monthly cost to NT$, and sets it beside subscription prices.

Go deeper AI Subscription or API: Which Costs Less in 2026? A Cost Calculator and Three Scenarios Three scenarios run through the calculator: light chat, daily agent coding, and a small app.

Check your actual usage in the tools:

  • Claude Code: /usage. On the API, the Session block lists tokens and estimated cost by model; on a subscription, it shows the share taken by subagents, skills and MCP servers2.
  • Codex: /status for this session’s token usage, /usage for your account’s daily and weekly usage6.

I’m on subscriptions on both sides, Claude Max x20 and GPT Pro, so subagents draw on plan allowances.

My real usage for the last 30 days is at the top of this post.

FAQ

Does running more subagents save money?

No. Each subagent has its own context and spends its own tokens. Codex’s docs say plainly that subagent workflows use more tokens than a comparable single-agent run4; Claude Code’s docs say subagent requests count toward the same usage as the main session1. Splitting cuts the unit price; the total token count only goes up. Something small enough to find in one or two lookups is cheaper done in the main session.

Can you use research from a cheap model as is?

I wouldn’t. A subagent returns a summary, and the main session should check it against the sources before deciding. Say “official sources only, a URL for every number” when you dispatch, so what comes back can be checked. For anything going live, my process adds a review by a strong model, and then I read it myself.

On a subscription, does the model choice still matter?

Yes. You don’t pay per token, but the allowance is used up by usage. Subagents default to the main session’s model, so when the main session runs the top model, every subagent without its own model setting burns allowance on the top model too1.

Go deeper Git Worktree and AI Subagents: How I Built 8 Tools in Parallel (2026) To let several agents change one repo at the same time, give each agent its own worktree.

Sources

  1. 1. Create custom subagents · Claude Code Docs · checked 2026-11-17
  2. 2. Manage costs effectively · Claude Code Docs · checked 2026-11-17
  3. 3. Pricing · Claude Platform Docs · checked 2026-11-17
  4. 4. Subagents · OpenAI Codex Docs · checked 2026-11-17
  5. 5. Pricing · OpenAI API Docs · checked 2026-11-17
  6. 6. Slash commands in Codex CLI · OpenAI Codex Docs · checked 2026-11-17

About the author

Kelvin Wang

Electrical engineer building tools with AI agents, sharing hands-on notes on engineering and investing.

More about me