Fix Your Codex Pro Plan Usage With Config.toml in 5 Minutes

@cjzafir
英语1天前 · 2026年7月11日
137K
361
20
16
852

TL;DR

This guide explains how to fix a token-draining flaw in Codex by setting up custom subagent routing in config.toml, utilizing a mix of Sol and Terra models for efficiency.

Your Codex 5x and 20x Pro plan is burning too fast. The reason is a routing flaw in how Codex handles subagents.

When you set GPT-5.6 Sol to "Ultra" in the model picker, every subagent Codex spawns also runs Sol Ultra.

The spawn_agent tool does not let you pick a different model or reasoning effort for the child. It copies the parent. Three subagents on one task means three Sol Ultra instances running at the same time, each burning through your quota at full speed.

https://x.com/evi77ain/status/2075445272013095033

You can cut that token usage by ~50% by using this smarter mix of models:

  • GPT 5.6 Sol Extra High as the main brain
  • GPT 5.6 Sol Medium for the smarter subagents
  • GPT 5.6 Terra High for the fast lightweight agents.

Why these three models? I'll get to that after we fix the config file.

The idea is simple. You need to have one “Orchestrator” model that does the thinking: planning, architecture, deciding what to delegate. Then you have “Executor” models that implement the plan. The executors are cheaper, faster, and smart enough to follow instructions without needing full-power reasoning.

Codex already supports this through a file called config.toml and custom agent definitions. You define agent roles in small config files, set which model each role uses, and add a routing policy that tells Codex when to use which agent. After that, Codex handles everything automatically. You submit tasks the same way you always have.

Ask Codex to build "Auto Mode" for you

Open Codex and paste this prompt. It will read your existing config, create the agent files, and update the routing policy.

text
1Read my current ~/.codex/config.toml and the docs at
2https://developers.openai.com/codex/subagents for custom agent definitions.
3
4Then do the following:
5
61. Create three agent TOML files under ~/.codex/agents/:
7
8 fast_scan — for quick searches, codebase exploration, file reads,
9 and lightweight analysis.
10 - model: gpt-5.6-terra
11 - model_reasoning_effort: high
12 - sandbox_mode: read-only
13 - Instructions: gather evidence quickly, return a concise summary,
14 do not edit files.
15
16 routine_worker — for routine coding, tests, documentation,
17 and bounded fixes.
18 - model: gpt-5.6-sol
19 - model_reasoning_effort: medium
20 - Instructions: implement the assigned task and verify the result.
21
22 deep_worker — for difficult debugging, architecture, security,
23 and ambiguous multi-step work.
24 - model: gpt-5.6-sol
25 - model_reasoning_effort: high
26 - Instructions: handle complex work carefully, validate assumptions,
27 provide strong verification.
28
292. Update the [agents] section of my config.toml with this routing policy:
30
31 "Automatically decide whether delegation is useful.
32 Choose fast_scan for lightweight read-only work, routine_worker
33 for normal implementation, and deep_worker for complex or
34 high-risk reasoning.
35 Do not ask the user to choose a model unless the required model
36 is unavailable.
37 Keep simple tasks on the main agent."
38
393. Make sure max_threads = 6 and max_depth = 1 are set under [agents].
40
414. Show me the final config.toml and all three agent files so I can
42 review before you save.

After Codex creates the files, restart Codex or open a new task. The agents load on startup.

What you should see after the fix?

Before this fix, every subagent ran the same model and reasoning effort as your main agent.

After this fix, Codex reads your agent files (autonomously) and picks a cheaper model when the task is simple. A file search routes to Terra High instead of Sol Ultra. A routine bug fix runs on Sol Medium. Only the hard stuff gets Sol High. Your main agent stays on whatever you set in the model picker when you started the session.

You can still override it. Say "use Sol only" or "don't use subagents" in your prompt and the routing steps aside.

What the agent files look like?

Codex will generate files that look like this. Each one lives under ~/.codex/agents/.

text
1# ~/.codex/agents/fast-scan.toml
2name = "fast_scan"
3description = "Use for quick searches, codebase exploration, and lightweight read-only analysis."
4model = "gpt-5.6-terra"
5model_reasoning_effort = "high"
6sandbox_mode = "read-only"
7developer_instructions = """
8Gather evidence quickly and return a concise summary.
9Do not edit files.
10"""
text
1# ~/.codex/agents/routine-worker.toml
2name = "routine_worker"
3description = "Use for routine coding, tests, documentation, and bounded fixes."
4model = "gpt-5.6-sol"
5model_reasoning_effort = "medium"
6developer_instructions = """
7Implement the assigned bounded task and verify the result.
8"""
text
1# ~/.codex/agents/deep-worker.toml
2name = "deep_worker"
3description = "Use for difficult debugging, architecture, security, and ambiguous multi-step work."
4model = "gpt-5.6-sol"
5model_reasoning_effort = "high"
6developer_instructions = """
7Handle complex work carefully, validate assumptions, and provide strong verification.
8"""

The routing policy in your config.toml tells the orchestrator when to use each one and when to keep work on the main agent.

Why these model and effort combinations?

GPT 5.6 has three models (Sol, Terra, Luna) and six reasoning effort levels (Low, Medium, High, Extra High, Max, Ultra). That is 18 possible combinations. Most of them are wrong for Codex subagent work. The routing above uses only four model variants, picked from two independent benchmark reports published this week.

Artificial Analysis tested every GPT 5.6 model at every reasoning level on 9 different tests covering reasoning, knowledge, and coding. They publish one combined score per model.

Sol at max reasoning scores 59 out of 100. Sol at extra high scores 58. That is one point of difference. The cost difference is roughly 3x — max burns about three times the tokens to get that one extra point.

For the root orchestrator that plans your tasks and coordinates subagents, extra high gives you the same quality of decisions at a third of the token cost. Max and Ultra are overkill for 99% of tasks.

CJ Zafir - inline image

Stay away from Ultra. Ultra is more expensive because it spawns four parallel sub-subagents inside a single agent. On Terminal-Bench (a test for command-line coding workflows), Sol Ultra scores 91.9% versus Sol at 88.8%. That is 3.1 extra points at roughly 3x the cost. OpenAI did not even publish Ultra results for their two main coding benchmarks. If you use Ultra on a subagent that is already a subagent, you get recursive spawning — subagents spawning more subagents. The Codex docs specifically warn against this.

Why Sol Medium for routine work?

Sol at medium reasoning still beats Claude Fable 5 by 11.4 points on Agents' Last Exam, a test of long-running workflows across 55 professional fields. It does this at about a quarter of the cost.

Medium is strong enough to follow a plan, write a feature, fix a bug, or run tests. It does not need to make architectural decisions on its own. Codex team also recommends using Sol medium as the daily driver model.

https://x.com/thsottiaux/status/2075581430055493909

Why Terra High for lightweight work, not Luna?

This is the one that surprises people. Luna is cheaper per token ($1/$6 per million) compared to Terra ($2.50/$15). But token price is not the full picture.

DeepSWE v1.1 tests coding agents on 113 real engineering tasks across 91 open source projects. It measures what percentage of tasks each model finishes, how much each task costs in total, and how many steps it takes.

Results from July 9, 2026:

  • Sol at max: finishes 73% of tasks, costs $8.39 per task, takes 61 steps.
  • Terra at max: 70%, $4.95, 76 steps.
  • Luna at max: 67%, $3.03, 102 steps.
  • Claude Fable 5 at max: 70%, $21.63, 88 steps.
  • Claude Opus 4.8 at max: 59%, $13.22, 120 steps.
CJ Zafir - inline image

Luna's $3.03 per task looks good until you see the step count. 102 steps versus Terra's 76. Each step is a tool call with its own input and output tokens. More steps means more total tokens burned, more time, and more chances for the model to loop on an error and retry.

Luna also cannot handle large codebases. On Nerova, a test that measures how well a model recalls information from long inputs, Luna scores 41.3%. Terra scores 89.6%. Sol scores 91.5%. When a subagent needs to search across thousands of files and hold that context, Luna misses things that Terra catches.

On the Artificial Analysis Coding Agent Index (which combines DeepSWE, Terminal-Bench, and SWE-Atlas-QnA into one coding score), Sol scores 80, Terra scores 77.4, Luna scores 74.6, and Claude Fable 5 scores 77.2. Terra is 2.6 points behind Sol but costs half as much. For a subagent that reads files and collects evidence, those 2.6 points do not matter. For a subagent doing hard multi-file debugging, they do — which is why that work goes to Sol High instead.

CJ Zafir - inline image

Terra at max also matches Claude Fable 5's DeepSWE score (both at 70%) at less than a quarter of Fable's cost ($4.95 vs $21.63). You are getting Fable-level coding performance on your lightweight subagent for $5.

The bottom line

Fix your config.toml file. Set your root agent to Sol Extra High. Set routine subagent work to Sol Medium. Set lightweight read-only work to Terra High. Skip Luna, skip Low, skip Ultra on subagents. Set it up once. Every Codex session after that routes automatically and your Pro plan lasts the way it should.

一键保存

使用 YouMind AI 深度阅读爆款文章

保存原文、追问细节、总结观点,并在一个 AI 工作空间里把爆款文章沉淀成可复用笔记。

了解 YouMind
写给创作者

把你的 Markdown 变成干净的 𝕏 文章

图片上传、表格、代码块,往 𝕏 上手动重排太痛苦。YouMind 把整篇 Markdown 一键转成干净、可直接发布的 𝕏 文章草稿。

试试 Markdown 转 𝕏

更多可拆解样本

近期爆款文章

探索更多爆款文章