Glossary / API mechanics
max_tokens
max_tokens caps how many tokens the model may generate in one response. The call stops mid-sentence when the cap is reached, and you are billed for what was produced.
Definition
max_tokens caps how many tokens the model may generate in one response. The call stops mid-sentence when the cap is reached, and you are billed for what was produced.
What it changes in your bill
It is the simplest hard ceiling on output cost. Without it, a confused model can generate thousands of tokens of repetition that you pay for.
How to check it yourself
Set max_tokens to roughly your 95th percentile answer length and log truncation rates; rising truncations mean the cap is too tight, not that the model is broken.
Related terms
Try it on Tapix AI
Tapix AI exposes 100+ models behind one OpenAI-compatible endpoint. Prepaid from $1, no monthly minimum, live prices per model.
Get a key and run one real call See live prices