Max tokens is a cap. The contract is the shape.

Context window is not max output. GPT-6.2 and Claude 5.5 publish 128k output, DeepSeek V4 384K, Gemini 4 65,536 by default with long decode to 1M, and Grok 4.7 has no text limit with a cap that leaves reasoning out. Field names and JSON schema contracts differ by vendor.

Two numbers
Context is the whole request. Max output is only what the model may generate. They are published separately.
Name the field
max_tokens, max_completion_tokens, max_output_tokens, and maxOutputTokens are not aliases you can mix.
Stay under it
Up to 65,536 fits every row. Above it, the limits split: 128,000 for OpenAI and Claude, 384K for DeepSeek, long decode for Gemini 4.
Bind the shape
Ask for json_schema with strict mode. Validate the parsed object. One retry, then fail. Do not accept free text.