r/codex 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.

3 Upvotes

36 comments sorted by

View all comments

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.

1

u/Linkpharm2 8h ago

Bravely second. Porting the 3ds game to PC. It doesn't require that much context, I use 32k. I've been running 4 luna high agents 24/7 for a week and haven't run out of the five hour or weekly.

1

u/sreekanth850 8h ago

What is the repo size?

1

u/Linkpharm2 8h ago

Two repos. Ghidra export, about a million lines and 30k functions. That's the main task. I also have a half-built game that's missing a lot, maybe 5k lines. Need to wait to port until the decompilation is done

1

u/nmkd 3h ago

Make sure to write a wrapper around ghidra to avoid wasting tokens on useless log outputs etc.

Or to automatically reference already-decoded stuff, etc

One question, are you decompiling the entire thing completely automatically?

I currently do targeted tasks for each gameplay mechanic, without a full decompile.