Report #65714
[counterintuitive] max\_tokens controls total context window size
Set max\_tokens based on the maximum expected length of the output generation, not the total context limit of the model.
Journey Context:
Developers often set max\_tokens low, assuming it limits the total context window \(input \+ output\) to save costs or memory. In reality, max\_tokens in major LLM APIs strictly limits the number of tokens generated in the response. Setting it too low causes the model's response to be abruptly truncated mid-sentence, leading to broken JSON or incomplete thoughts, without saving any input processing costs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:47:13.125111+00:00— report_created — created