loading
loading
The hard cap on how many tokens the model is allowed to generate in one response.
max_tokens limits output length only — it does not make the model aim for that length, it just guillotines generation when the cap is hit, often mid-sentence. Set it too low and you get truncated JSON or cut-off answers; set it too high and you risk paying for runaway output and slower responses. It also reserves space against the context window, so a huge max_tokens on a huge prompt can error before generating. Right-size it to the task: 200 for a label, 4000 for an essay.
Plainly
Think of Max Tokens as a tool from the builder toolbox. The hard cap on how many tokens the model is allowed to generate in one response.
In practice
Use it when you are installing, editing, testing, reviewing, or shipping code. In practice, define the owner, input, output, and failure mode before you rely on it.