環境変数

CLAUDE_CODE_MAX_OUTPUT_TOKENS

ほとんどのリクエストに対する出力トークンの最大数を設定する。既定値と上限はモデルによって異なる。モデルの上限を超える値は、Claude Code がその上限まで引き下げる。Claude Code が既知のモデルに解決できないモデル ID の場合、既定値は 32000、上限は 128000 である。この値を大きくすると、自動コンパクションが発動するまでに使える実効的なコンテキストウィンドウが縮む

使い方・用途

  • Claude の応答が出力トークンの上限に達して途中で切れる「Response exceeded the output token maximum」エラーを避けたいとき、上限値を引き上げるために設定する。
  • 拡張思考の予算が出力上限を超えて回答用の余裕がなくなる「Thinking budget exceeds output limit」の状態を解消するため、思考予算より大きい値に設定する。
英語原文(公式ドキュメントより)

Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see max output tokens. Claude Code lowers a value above a model's cap to the cap. For a model ID Claude Code can't resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before auto-compaction triggers

関連ドキュメント

関連する変更履歴

v2.1.208(1件)

Fixed
CLAUDE_CODE_MAX_OUTPUT_TOKENS などの環境変数で指数表記(1e6 など)を使用すると、仮数部のみが読み取られてしまう(1e6 が 1 になる)問題を修正した。
英語原文を表示
Fixed CLAUDE_CODE_MAX_OUTPUT_TOKENS and similar env vars silently using the mantissa of scientific-notation values (1e6 became 1)

変更後

大きな数値を設定する際に、桁数を数えてゼロを並べる必要がなくなります。

関連ドキュメント

v2.1.69(1件)

Fixed
Fixed CLAUDE_CODE_MAX_OUTPUT_TOKENS being ignored during conversation compaction

関連ドキュメント