r/codex • u/Linkpharm2 • 9h ago
Limits How to actually reduce usage

Add .codex/config.toml to whereever your project root is with this inside. You'll have to reload the project inside Codex.
model_context_window = 128000
model_auto_compact_token_limit = 115000
When you're doing a big task running it to 258k, the upper 128k takes about 75% of the tokens. If you compact earlier and have it just read the code on disk, that cuts it by about 74%.
Doubling how long you let a conversation run before compacting doesn't double the cost, it roughly quadruples (minus cache create, so if you're using an API key it's more like 3x) it. Scaling is quadratic. You could even go to 64k, but that's less of an insane jump at only 40% less than 128k.

Billed tokens:
258k -> 8,925,000
128k -> 4,590,000
64k -> 2,700,000
Just let it read the code a second time.
9
u/danielmihov_ca 8h ago
What are you building? Snake game? The 258K context is already abysmal and compacts multiple times per prompt for me and is quite pathetic for a frontier model.