Basics

Max tokens

Max tokens is a request parameter that caps how many tokens a model may write in one answer. When the answer reaches the cap, the model stops, even in the middle of a sentence.

Also called max_tokens, max_completion_tokens, max_output_tokens, Output token limit

Checked November 29, 2026

At a glance

Limits
The output of one answer
Chat Completions
max_completion_tokens
Responses API
max_output_tokens
Messages API
max_tokens
Includes thinking
Yes, on Claude and on OpenAI's reasoning models
On /model
Lowered to what your balance or cap covers, not below 1,024

It limits the output, not the input. The input is limited by the context window, which has to leave room for the answer, and each model also has its own ceiling on how much it can write in one answer.

One limit, three names

  • OpenAI Chat Completions

    Parameter
    max_completion_tokens
  • OpenAI Responses

    Parameter
    max_output_tokens
  • Anthropic Messages

    Parameter
    max_tokens

OpenAI names the first two (OpenAI). On Anthropic's Messages API, an answer that reaches the limit ends with stop_reason max_tokens (Anthropic).

Leave room for thinking

Thinking is part of the output. On Claude, thinking tokens count toward max_tokens (Anthropic); at OpenAI, max_output_tokens caps everything the model generates, reasoning tokens included (OpenAI). A limit sized for the answer alone can cut the answer short.

Max tokens on /model

  • Each model's own ceiling is its max_output_tokens in GET /v1/models (Models).
  • When your balance, or a key's daily or monthly cap, is nearly used up, a request is still served with max_tokens lowered to what's left, but not below 1,024 tokens. Below that it is refused with a 402, and the message says how many output tokens are left (Errors).
  • A non-streaming answer has 15 minutes to finish. Stream long answers (Limits and timeouts).

Where it applies on /model

Questions

Why did the answer stop in the middle of a sentence?

It most likely reached the max tokens limit. Raise the limit, or ask for a shorter answer. With thinking on, part of the limit went to thinking.

Does a higher limit cost more?

No. You pay for the tokens the model writes, not for the limit. A higher limit only lets a longer answer through.

Why was my max_tokens lowered on /model?

Your balance, or the key's daily or monthly cap, covers fewer tokens than you asked for. The request still runs, with the limit lowered to what's left, down to 1,024 tokens. Top up, or raise the cap, to get the full limit back.

Sources

The makers' own pages, each opened on November 29, 2026.

One key for every model here.

Top up from $10, change one URL, and pay only for the tokens you use.