Skip to content
BENIBIX Learn

CLAUDE_CODE_MAX_OUTPUT_TOKENS

AI⌨️ Claude CodeConfiguration

Also known as CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable

It sets how many tokens Claude may write in one reply.

Think of it like

It is like a page limit. One answer can only fill so much.

Example

Jack's gateway model is not one Claude Code knows, so replies stop at 32,000 tokens. He raises this, and long files come out whole.

Why it matters

Too low and long work stops halfway. Too high and the chat fills up sooner.

Definition

CLAUDE_CODE_MAX_OUTPUT_TOKENS sets how many tokens Claude may write in one reply. The default and the top value depend on the model. A value over a model's top is cut down to it. For a model ID Claude Code does not know, the default is 32,000 and the top is 128,000. Raising it leaves less room in the chat before it is squeezed.

Example code

bash
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000
claude
Let replies run longer.
Output room is the slice kept free at the end.

Common mistake

Setting it as high as it goes. The space it takes comes out of the room for the chat itself.

Key takeaways

  1. 1
    Per reply. Tokens Claude writes.
  2. 2
    Cut to the model's top. No error.
  3. 3
    Costs chat room. Compacts sooner.