AI 101

Max tokens

Also known as: max_tokens · output limit

Inference

Max tokens (often max_tokens or max_completion_tokens) caps how many tokens the model may generate in a single response.

  • Prevents endless, looping, or runaway output.
  • Controls cost (you pay per generated token).
  • Set it based on the task: a one-word label needs ~10; an essay needs thousands.

Distinct from context window: max-tokens limits the *output*; the context window limits *input + output together*. Don't mix them up.