環境変数

CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES

タイムアウトした非ストリーミングリクエストを Claude Code が再送信する回数を制限する環境変数で、0 にすると最初のタイムアウトでリクエストが失敗し、デフォルトでは未設定のため再送回数は CLAUDE_CODE_MAX_RETRIES が制限します(タイムアウトの調整については Tune retry behavior を参照、Claude Code v2.1.285 以降が必要)。

使い方・用途

  • タイムアウトした非ストリーミングフォールバックリクエストの再送回数を上限で抑え、無限再送による待ち時間やネットワーク負荷の増大を防ぐ
  • 再送回数が上限に達するとリクエストは失敗する。生成にタイムアウト以上かかる応答は再送のたびに再びタイムアウトするため、早めに失敗させたい場合は 0 などの低い値を設定する
  • デフォルトは未設定で、CLAUDE_CODE_MAX_RETRIES が再送回数を制限する。非ストリーミングの各試行はローカルセッションでは 300 秒後、API_TIMEOUT_MS に正の値を設定した場合はその値の時間後にタイムアウトする(v2.1.285 以降)
英語原文(公式ドキュメントより)

Limit how many times Claude Code re-sends a non-streaming request that times out. With 0, the request fails on the first timeout. Unset by default, so CLAUDE_CODE_MAX_RETRIES limits these re-sends. See Tune retry behavior for the timeout. Requires Claude Code v2.1.285 or later

関連ドキュメント

関連する変更履歴

v2.1.285(1件)

Added
タイムアウトした非ストリーミングフォールバックリクエストの再送回数を上限で抑えるための環境変数 CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES を追加した。
英語原文を表示
Added CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES environment variable to cap re-sends of a non-streaming fallback request that timed out

変更前

When a streaming request timed out and Claude Code fell back to a non-streaming request, it could resend the request that timed out without limit.

変更後

...This is related to network/error handling documentation, specifically around non-streaming fallback behavior and automatic retries. The env var is for capping re-sends of non-streaming fallback requests that timed out. Is it related to Settings? Environment variables relate to configuration — but the

ユーザーへの恩恵

By capping resent requests, users can prevent wait times and network load from ballooning due to endless retries.