環境変数

CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD

1 を設定すると、Amazon Bedrock のストリーミングレスポンスが application/vnd.amazon.eventstream のコンテンツタイプを持つことのチェックをスキップする。この変数がない場合、レスポンスが別のコンテンツタイプを持つと、Claude Code はそのタイプ名を示すエラーでリクエストを失敗させる。これはゲートウェイやプロキシがレスポンスを変換していることを意味する。この変数を設定するのではなく、ゲートウェイが Content-Type ヘッダーとボディを変更せずに転送するよう設定すること。Claude Code v2.1.208 以降が必要。

使い方・用途

  • Claude Code と Amazon Bedrock の間に配置したゲートウェイやプロキシが Content-Type を書き換えてしまう環境で、Bedrock ストリーミング応答の content-type 検査をスキップしてエラーを回避したい場合
  • ゲートウェイがストリームを server-sent events として再送出し、Content-Type が text/event-stream に書き換わる構成で暫定的に動作させたい場合
英語原文(公式ドキュメントより)

Set to 1 to skip the check that an Amazon Bedrock streaming response carries the application/vnd.amazon.eventstream content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a gateway or proxy is transforming the response. Configure the gateway to forward the Content-Type header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later

関連ドキュメント