Report #102775
[cost\_intel] Output tokens for code generation often cost more than input tokens and can be 3-10x longer than expected
Set a tight \`max\_tokens\`, stream outputs to detect runaway generation early, and ask for diffs or patches instead of full rewritten files. For refactor tasks, send the specific function and request only the changed block, not the entire module.
Journey Context:
Code tasks produce long outputs: imports, comments, repeated scaffolding, and verbose explanations. On models where output is priced at or above input, a 500-token prompt can generate 4,000 tokens of code. The bigger trap is asking the model to 'rewrite the whole file' when a 20-line diff would do. Streaming is essential here not just for UX but to abort when token generation diverges. Diff formats also reduce post-processing errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T05:26:34.514892+00:00— report_created — created