Context window and maximum output: what context_length and max_output_tokens mean

All in One AIPlayground & Text Models·· 2 views· 3 min read

Every text model has two limits: how much it reads at once, context_length, and how much it writes in one answer, max_output_tokens. Both are counted in tokens.

The two numbers

Field What it is
context_length The most tokens the model reads in one request, input and output together.
max_output_tokens The most tokens the model writes in one answer.

Two examples from the documentation: deepseek-ai/deepseek-v4-flash reads up to 1,048,576 tokens and writes up to 393,216; moonshotai/kimi-k2.6 reads up to 262,144 and writes up to 262,144.

Where you see them

The Models tab shows the context of each text model ("Context: N tokens"). Both fields come in GET /v1/models and in the aio model command, followed by the id.

What counts towards the context

Everything in the request: the instructions, the whole conversation, the texts you pasted and the answer itself. In a conversation, each new message carries the earlier ones. For agents, the instructions and the knowledge go in every request. That is why a very long conversation ends up hitting the limit. The Playground shows "The conversation is too long. Please start a new one." See why the AI forgets what you said earlier.

max_output_tokens and your max_tokens

max_output_tokens is the model's ceiling. max_tokens is the limit you set on each request, below that ceiling. The credit reservation counts your max_tokens, or 4,096 if you do not send it. In the Playground, the "Maximum tokens in the reply" field takes 16 to 32,768, and the estimate never counts more than the model's maximum output.

In coding tools

When a tool asks for the context size, use context_length. For the maximum output, use a smaller value. We reserve credits for the maximum output the tool asks for in each answer. That is why the examples ask for 16,000 tokens: it is enough for coding and needs a smaller balance than a higher value.

See the context of each model on the Models tab.

See All in One AI

SEE ALSO

Why the AI forgets what you said earlier: context and long conversations

Choosing a text model: price, context window and what each one is for

The Models tab: searching for a model and copying its id

Tokens explained: how AI model APIs are counted

All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $5.36/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.