---
title: Claude APIのエラー
url: https://platform.claude.com/docs/ja/api/errors
description: Claude APIが返すHTTPステータスコード、エラーレスポンスの形式、リクエストIDを理解し、SDKの型付き例外でエラーを処理します。
---

## HTTPエラー

APIは予測可能なHTTPエラーコード形式に従います。

* 400 - `invalid_request_error`：リクエストの形式または内容に問題がありました。このエラータイプは、このセクションに記載されていない他の4XXステータスコードにも使用される場合があります。また、使用量が組織またはワークスペースに[設定した支出制限](https://platform.claude.com/docs/ja/api/rate-limits#setting-your-own-spend-limit)に達した場合にも、APIは400を返します。ただし、[Claude Codeワークスペース](https://platform.claude.com/docs/ja/manage-claude/workspaces#claude-code-workspace)の制限は例外で、代わりに429を返すことがあります。

* 401 - `authentication_error`：[APIキー](https://platform.claude.com/docs/ja/get-api-key)に問題があります（たとえば、形式が不正である、取り消されている、または有効期限が切れているなど。[キーの有効期限](https://platform.claude.com/docs/ja/manage-claude/authentication#key-expiration)を参照してください）。Claude Platform on AWSでは、AWS認証情報またはSigV4署名の問題を示している場合もあります。

* 402 - `billing_error`：請求情報または支払い情報に問題があります。[Claude Console](https://platform.claude.com)で、またはClaude Platform on AWSを使用している場合はAWS Marketplaceで、支払いの詳細を確認してください。

* 403 - `permission_error`：APIキーに、指定されたリソースを使用する権限がありません。[Claude Console](https://platform.claude.com)で組織のアクセス設定とワークスペース設定を確認してください。

* 404 - `not_found_error`：リクエストされたリソースが見つかりませんでした。エンドポイントのパスと、リクエストURL内のリソースIDを確認してください。

* 409 - `conflict_error`：リクエストがリソースの現在の状態と競合しています。たとえば、リソースが同時に変更された場合や、一意である必要がある値がすでに使用されている場合です。競合を解決してから、リクエストを再試行してください。

* 413 - `request_too_large`：リクエストが許可されている最大バイト数を超えています。エンドポイントごとの上限については[リクエストサイズ制限](https://platform.claude.com/docs/ja/api/errors#request-size-limits)を参照してください。

* 429 - `rate_limit_error`：組織が[「rate limit」（レート制限）](https://platform.claude.com/docs/ja/api/rate-limits)に達したか、使用量ティアの月間支出上限に達したか、Claude Codeワークスペースの支出制限に達しました。ティアの支出上限による429には`retry-after`ヘッダーがなく、アクセスが再開されるまで失敗し続けます。見分け方については[使用量上限に達した場合](https://platform.claude.com/docs/ja/api/rate-limits#reaching-your-spend-cap)を参照してください。

* 500 - `api_error`：Anthropicのシステム内部で予期しないエラーが発生しました。「exponential backoff」（指数バックオフ）を使用してリクエストを再試行してください。エラーが解消しない場合は、[リクエストID](https://platform.claude.com/docs/ja/api/errors#request-id)を添えてサポートにお問い合わせください。

* 504 - `timeout_error`：処理中にリクエストがタイムアウトしました。長時間実行されるリクエストには、[ストリーミングMessages API](https://platform.claude.com/docs/ja/build-with-claude/streaming)の使用を検討してください。その他のオプションについては[長時間のリクエスト](https://platform.claude.com/docs/ja/api/errors#long-requests)を参照してください。

* 529 - `overloaded_error`：APIが一時的に過負荷状態です。

  <Warning>
    529エラーは、すべてのユーザーにわたってAPIのトラフィックが多い場合に発生することがあります。

    まれに、組織の使用量が急激に増加した場合、APIの加速制限（acceleration limits）により429エラーが表示されることがあります。加速制限に達しないようにするには、トラフィックを段階的に増やし、一貫した使用パターンを維持してください。
  </Warning>

公式SDKは、一時的な障害（接続エラー、レート制限、5xxサーバーエラーなど）を指数バックオフで自動的に再試行します。デフォルトでは2回再試行し、`retry-after`ヘッダーが存在する場合はそれに従います。SDKクライアントは`max_retries` (typescript, java, php: `maxRetries`; csharp: `MaxRetries`; go: `option.WithMaxRetries`)を受け付け、この動作を設定または無効化できます。

「server-sent events」（サーバー送信イベント）、すなわちSSEを介して[ストリーミング](https://platform.claude.com/docs/ja/build-with-claude/streaming)レスポンスを受信する場合、APIが200レスポンスを返した後にエラーが発生することがあります。その場合、エラー処理はこれらの標準的な仕組みに従いません。ストリーム途中のエラーの形式については[エラーイベント](https://platform.claude.com/docs/ja/build-with-claude/streaming#error-events)を参照してください。

## リクエストサイズ制限

APIはリクエストサイズ制限を適用します。

| エンドポイントの種類                                                                          | 最大リクエストサイズ |
| ----------------------------------------------------------------------------------- | ---------- |
| Messages API                                                                        | 32 MB      |
| Token Counting API                                                                  | 32 MB      |
| [Batch API](https://platform.claude.com/docs/ja/build-with-claude/batch-processing) | 256 MB     |
| [Files API](https://platform.claude.com/docs/ja/build-with-claude/files)            | 500 MB     |

これらの制限を超えると、413 `request_too_large`エラーが返されます。直接のClaude APIでは、リクエストがAPIサーバーに到達する前にCloudflareがこのエラーを返します。

## エラーの形式

APIは常にエラーをJSONとして返します。トップレベルの`error`オブジェクトには常に`type`と`message`の値が含まれます。レスポンスには、追跡とデバッグを容易にするための`request_id`フィールドも含まれます。例：

```json JSON
{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "The requested resource could not be found."
  },
  "request_id": "req_011CSHoEeqs5C35K2UUqR7Fy"
}
```

[バージョニング](https://platform.claude.com/docs/ja/api/versioning)ポリシーに従い、これらのオブジェクト内の値は拡張される可能性があり、`type`の値が時間とともに増える可能性があります。

## SDKのエラータイプ

公式SDKは、生のJSONを返す代わりに、これらのエラーに対して型付き例外を発生させます。たとえば、404は`anthropic.NotFoundError` (typescript: `Anthropic.NotFoundError`; ruby: `Anthropic::Errors::NotFoundError`; java: `com.anthropic.errors.NotFoundException`; csharp: `AnthropicNotFoundException`; php: `Anthropic\Core\Exceptions\NotFoundException`; go: `*anthropic.Error`)として通知されます。Go SDKにはすべてのステータスに対して1つのエラータイプ`*anthropic.Error`があるため、`StatusCode`で分岐してください。エラーメッセージを文字列照合するのではなく、SDKの型付きクラスをキャッチし、最も具体的なクラスから先に処理してください。例外階層の全体は、各SDKのページに記載されています。

* [Python](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/python#handling-errors) · [TypeScript](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/typescript#handling-errors) · [C#](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/csharp#error-handling) · [Go](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/go#error-handling) · [Java](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/java#error-handling) · [PHP](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/php#error-handling) · [Ruby](https://platform.claude.com/docs/ja/cli-sdks-libraries/sdks/ruby#handling-errors)

## リクエストID

すべてのAPIレスポンスには一意の`request-id`ヘッダーが含まれます。このヘッダーには`req_018EeWyXxfu5pfWkrYcMdjWG`のような値が含まれます。同じ識別子が[エラーレスポンス本文](https://platform.claude.com/docs/ja/api/errors#error-shapes)の`request_id`フィールドにも表示されます。特定のリクエストについてサポートに問い合わせる際は、問題を迅速に解決できるようこのIDを含めてください。

[Claude Platform on AWS](https://platform.claude.com/docs/ja/build-with-claude/claude-platform-on-aws)では、レスポンスに2つのリクエストIDが含まれます。AWSリクエストID（`x-amzn-requestid`、プライマリ、CloudTrailでインデックス化）とAnthropicリクエストID（`request-id`、セカンダリ）です。CloudTrailの検索にはAWSリクエストIDを、AnthropicのサポートチケットにはAnthropicリクエストIDを使用してください。

PythonおよびTypeScript SDKでは、トップレベルのレスポンスオブジェクトの`_request_id`プロパティからリクエストIDを取得できます。C#、Go、Java、PHP SDKでは生レスポンスのアクセサーから、Ruby SDKでは[ミドルウェア](https://platform.claude.com/docs/ja/cli-sdks-libraries/middleware)から取得できます。Ruby以外のすべてのSDKでは、`with_raw_response` (typescript: `.withResponse()`; java: `.withRawResponse()`; csharp: `WithRawResponse`; go: `option.WithResponseInto`; php: `->raw`)を使用すると、`anthropic-organization-id`や[`anthropic-workspace-id`](https://platform.claude.com/docs/ja/manage-claude/workspaces#identify-the-workspace-behind-an-api-response)など、その他の[レスポンスヘッダー](https://platform.claude.com/docs/ja/api/overview#response-headers)も読み取れます。Rubyでは、同じミドルウェアを使用してください。Claude Platform on AWSでは、生レスポンスのアクセサーを使用してAWSリクエストID（`x-amzn-requestid`）も読み取れます。

<CodeGroup>
  ```bash cURL
  # レスポンスヘッダー（request-idを含む）を出力し、本文は破棄する
  curl -sS -D - -o /dev/null https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2023-06-01" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5",
      "max_tokens": 1024,
      "messages": [{"role": "user", "content": "Hello, Claude"}]
    }'
  ```

  ```bash CLI
  # request-idヘッダーは--debugを指定するとstderrに出力されます:
  ant --debug messages create \
    --model claude-sonnet-5 \
    --max-tokens 1024 \
    --message '{role: user, content: "Hello, Claude"}'
  ```

  ```python Python
  client = anthropic.Anthropic()

  message = client.messages.create(
      model="claude-sonnet-5",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Hello, Claude"}],
  )
  print(f"Request ID: {message._request_id}")
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  const message = await client.messages.create({
    model: "claude-sonnet-5",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello, Claude" }]
  });
  console.log("Request ID:", message._request_id);
  ```

  ```csharp C#
  AnthropicClient client = new();

  using var response = await client.WithRawResponse.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5,
      MaxTokens = 1024,
      Messages = [new() { Role = Role.User, Content = "Hello, Claude" }]
  });
  Console.WriteLine($"Request ID: {response.RequestID}");
  ```

  ```go Go
  client := anthropic.NewClient()

  var response *http.Response
  _, err := client.Messages.New(
  	context.Background(),
  	anthropic.MessageNewParams{
  		Model:     anthropic.ModelClaudeSonnet5,
  		MaxTokens: 1024,
  		Messages: []anthropic.MessageParam{
  			anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
  		},
  	},
  	option.WithResponseInto(&response),
  )
  if err != nil {
  	panic(err)
  }

  fmt.Println("Request ID:", response.Header.Get("request-id"))
  ```

  ```java Java
  import com.anthropic.client.AnthropicClient;
  import com.anthropic.client.okhttp.AnthropicOkHttpClient;
  import com.anthropic.core.http.HttpResponseFor;
  import com.anthropic.models.messages.Message;
  import com.anthropic.models.messages.MessageCreateParams;
  import com.anthropic.models.messages.Model;

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      HttpResponseFor<Message> response = client.messages().withRawResponse().create(
          MessageCreateParams.builder()
              .model(Model.CLAUDE_SONNET_5)
              .maxTokens(1024)
              .addUserMessage("Hello, Claude")
              .build()
      );

      IO.println("Request ID: " + response.requestId().orElse(null));
  }
  ```

  ```php PHP
  $client = new Client();

  $response = $client->messages->raw->create([
      'model' => 'claude-sonnet-5',
      'maxTokens' => 1024,
      'messages' => [['role' => 'user', 'content' => 'Hello, Claude']],
  ]);
  echo 'Request ID: ' . $response->getHeaderLine('request-id') . "\n";
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  # リクエストごとのミドルウェアでレスポンスヘッダーを読み取ります。ミドルウェアは
  # SDKが解析する前の生のHTTPレスポンスを受け取ります
  request_id = nil
  read_request_id = lambda do |request, call_next|
    response = call_next.call(request)
    # response.headers のキーは小文字です
    request_id = response.headers["request-id"]
    response
  end

  client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5,
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello, Claude" }],
    request_options: { middleware: [read_request_id] }
  )
  puts "Request ID: #{request_id}"
  ```

  ```python Python (Claude Platform on AWS)
  from anthropic import AnthropicAWS

  client = AnthropicAWS(aws_region="us-west-2")

  response = client.messages.with_raw_response.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Hello, Claude"}],
  )
  print(f"AWS request ID: {response.headers.get('x-amzn-requestid')}")
  message = response.parse()
  print(f"Anthropic request ID: {message._request_id}")
  ```

  ```typescript TypeScript (Claude Platform on AWS)
  import AnthropicAws from "@anthropic-ai/aws-sdk";

  const client = new AnthropicAws({ awsRegion: "us-west-2" });

  const { response: raw, request_id } = await client.messages
    .create({
      model: "claude-opus-5-5",
      max_tokens: 1024,
      messages: [{ role: "user", content: "Hello, Claude" }]
    })
    .withResponse();
  console.log("AWS request ID:", raw.headers.get("x-amzn-requestid"));
  console.log("Anthropic request ID:", request_id);
  ```
</CodeGroup>

他の言語でのClaude Platform on AWSのリクエストIDの例については、[リクエストID](https://platform.claude.com/docs/ja/build-with-claude/claude-platform-on-aws#request-ids)を参照してください。

## 長時間のリクエスト

<Warning>
  長時間実行されるリクエスト、特に10分を超えるリクエストには、[ストリーミングMessages API](https://platform.claude.com/docs/ja/build-with-claude/streaming)または[Message Batches API](https://platform.claude.com/docs/ja/api/messages/batches/create)の使用を検討してください。
</Warning>

[ストリーミングMessages API](https://platform.claude.com/docs/ja/build-with-claude/streaming) または[Message Batches API](https://platform.claude.com/docs/ja/api/messages/batches/create)を使用せずに、大きな`max_tokens`値を設定することは避けてください。

* 一部のネットワークでは、一定時間が経過するとアイドル状態の接続が切断されることがあり、 その結果、Anthropicからレスポンスを受信せずにリクエストが失敗またはタイムアウトする可能性があります。
* ネットワークの信頼性はさまざまです。[Message Batches API](https://platform.claude.com/docs/ja/api/messages/batches/create)を使用すると、 途切れないネットワーク接続を必要とせずに結果をポーリングできるため、ネットワーク問題のリスクを管理するのに役立ちます。

直接のAPI統合を構築している場合、[TCPソケットのキープアライブ](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/programming.html)を設定すると、一部のネットワークでアイドル接続のタイムアウトによる影響を軽減できます。

[SDK](https://platform.claude.com/docs/ja/cli-sdks-libraries/overview)は、非ストリーミングのMessages APIリクエストが10分のタイムアウトを超えると予想されないことを検証します。また、TCPキープアライブのソケットオプションも設定します。

イベントを段階的に処理する必要がない場合は、SDKがストリームを消費して、非ストリーミング呼び出しが返すものと同一の完全な`Message`オブジェクトを返すことができます。

<CodeGroup exclude="shell:cURL">
  <CodeGroupItem language="cURL">
    curlリクエストは生のストリームイベントを出力し、それらを最終メッセージに結合することはできません。ストリームから完全な`Message`オブジェクトを取得するには、[Claude SDK](https://platform.claude.com/docs/ja/cli-sdks-libraries/overview)を使用してください。
  </CodeGroupItem>

  ```bash CLI
  # CLI はイベントをストリーミングします。--format jsonl は 1 行に 1 イベントを出力します
  ant messages create --stream --format jsonl <<'YAML'
  model: claude-sonnet-5
  max_tokens: 128000
  messages:
    - role: user
      content: Write a detailed analysis...
  YAML
  ```

  ```python Python
  client = anthropic.Anthropic()

  with client.messages.stream(
      max_tokens=128000,
      messages=[{"role": "user", "content": "Write a detailed analysis..."}],
      model="claude-sonnet-5",
  ) as stream:
      message = stream.get_final_message()

  print(next(block.text for block in message.content if block.type == "text"))
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  const stream = client.messages.stream({
    max_tokens: 128000,
    messages: [{ role: "user", content: "Write a detailed analysis..." }],
    model: "claude-sonnet-5"
  });

  const message = await stream.finalMessage();
  const textBlock = message.content.find((block) => block.type === "text");
  if (textBlock && textBlock.type === "text") {
    console.log(textBlock.text);
  }
  ```

  ```csharp C#
  AnthropicClient client = new();

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5,
      MaxTokens = 128000,
      Messages = [new() { Role = Role.User, Content = "Write a detailed analysis..." }]
  };

  var message = await client.Messages.CreateStreaming(parameters).Aggregate();
  Console.WriteLine(message);
  ```

  ```go Go
  client := anthropic.NewClient()

  stream := client.Messages.NewStreaming(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet5,
  	MaxTokens: 128000,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Write a detailed analysis...")),
  	},
  })

  message := anthropic.Message{}
  for stream.Next() {
  	event := stream.Current()
  	if err := message.Accumulate(event); err != nil {
  		log.Fatal(err)
  	}
  }
  if err := stream.Err(); err != nil {
  	log.Fatal(err)
  }

  for _, block := range message.Content {
  	if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
  		fmt.Println(textBlock.Text)
  		break
  	}
  }
  ```

  ```java Java
  import com.anthropic.client.AnthropicClient;
  import com.anthropic.client.okhttp.AnthropicOkHttpClient;
  import com.anthropic.helpers.MessageAccumulator;
  import com.anthropic.models.messages.ContentBlock;
  import com.anthropic.models.messages.Message;
  import com.anthropic.models.messages.MessageCreateParams;
  import com.anthropic.models.messages.Model;

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_SONNET_5)
          .maxTokens(128000L)
          .addUserMessage("Write a detailed analysis...")
          .build();

      MessageAccumulator accumulator = MessageAccumulator.create();
      try (var streamResponse = client.messages().createStreaming(params)) {
          streamResponse.stream().forEach(accumulator::accumulate);
      }

      Message message = accumulator.message();
      message.content().stream()
              .filter(ContentBlock::isText)
              .findFirst()
              .flatMap(ContentBlock::text)
              .ifPresent(textBlock -> IO.println(textBlock.text()));
  }
  ```

  ```php PHP
  use Anthropic\Lib\Streaming\MessageAccumulator;

  $client = new Client();

  $stream = $client->messages->createStream(
      model: 'claude-sonnet-5',
      maxTokens: 128000,
      messages: [['role' => 'user', 'content' => 'Write a detailed analysis...']],
  );

  $accumulator = MessageAccumulator::forMessages();
  foreach ($stream as $event) {
      $accumulator->accumulate($event);
  }

  echo array_find($accumulator->message()->content, static fn ($block): bool => $block->type === 'text')->text;
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  message = client.messages.stream(
    model: "claude-sonnet-5",
    max_tokens: 128000,
    messages: [{ role: "user", content: "Write a detailed analysis..." }]
  ).accumulated_message

  puts message.content.find { it.type == :text }.text
  ```
</CodeGroup>

詳細については、[ストリーミングメッセージ](https://platform.claude.com/docs/ja/build-with-claude/streaming#get-the-final-message-without-handling-events)を参照してください。

## よくあるバリデーションエラー

### プリフィルはサポートされていません

Claude 4.6以降のモデルおよび[Claude Mythos Preview](https://anthropic.com/glasswing)は、アシスタントメッセージの「prefill」（プリフィル）をサポートしていません。これらのモデルのいずれかに、最後のアシスタントメッセージをプリフィルしたリクエストを送信すると、400 `invalid_request_error`が返されます。

```json
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "This model does not support assistant message prefill. The conversation must end with a user message."
  }
}
```

代わりに、サポートしているモデルでは[構造化出力](https://platform.claude.com/docs/ja/build-with-claude/structured-outputs)、システムプロンプトでの指示、または[`output_config.format`](https://platform.claude.com/docs/ja/build-with-claude/structured-outputs#usage)を使用してください。

### thinkingブロックは変更できません

最新のアシスタントメッセージに、APIに送り返される前に編集、並べ替え、除外、または再構築された`thinking`または`redacted_thinking`ブロックが含まれている場合、リクエストは400 `invalid_request_error`を返します。エラーメッセージは問題のあるブロックの位置（例：`messages.1.content.0`）で始まり、次の内容を含みます。

```text wrap
`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
```

「tool use」（ツール使用）では、アシスタントターンのすべての`thinking`および`redacted_thinking`ブロックを、`thinking`フィールドが空のブロックも含めて、受信したとおりに正確に渡し返す必要があります。thinkingブロックは変更せずに渡し返してください。アプリケーションが再送信前にコンテンツブロックをタイプでフィルタリングする場合は、`thinking`と`redacted_thinking`の両方を含めてください。[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-blocks-modified)、[thinkingブロックの保持](https://platform.claude.com/docs/ja/build-with-claude/thinking#preserving-thinking-blocks)、および[保持された思考](https://platform.claude.com/docs/ja/build-with-claude/thinking#preserved-thinking)を参照してください。

### 拡張思考はサポートされていません

Claude 4.7以降のモデルでは「extended thinking」（拡張思考）が削除されました。これらのモデルのいずれかに`thinking: {"type": "enabled"}`を送信すると、400 `invalid_request_error`が返されます。

```text wrap
"thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.
```

代わりに[適応型思考](https://platform.claude.com/docs/ja/build-with-claude/thinking)を使用してください。[適応型思考への移行](https://platform.claude.com/docs/ja/build-with-claude/extended-thinking#migrating-to-adaptive-thinking)にパラメータの対応関係が示されており、[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-type-enabled)では症状から始める修正方法を説明しています。

### 適応型思考はサポートされていません

拡張思考のみをサポートするモデル（Claude 4.5以前のモデル）は、`thinking: {"type": "adaptive"}`を400 `invalid_request_error`で拒否します。

```text wrap
adaptive thinking is not supported on this model
```

これらのモデルでは`thinking: {"type": "enabled", "budget_tokens": N}`を使用してください。設定については[拡張思考](https://platform.claude.com/docs/ja/build-with-claude/extended-thinking)を、症状から始める修正方法については[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-type-adaptive)を参照してください。

### 思考は無効にできません

Claude Fable 5.1、[Claude Mythos 5.1](https://platform.claude.com/docs/ja/models/mythos-5-1/overview)、Claude Fable 5、[Claude Mythos 5](https://platform.claude.com/docs/ja/models/mythos-5/overview)、Claude Opus 5.5、および[Claude Mythos Preview](https://anthropic.com/glasswing)では、思考は常にオンです。これらのモデルのいずれかに`thinking: {"type": "disabled"}`を送信すると、400 `invalid_request_error`が返されます。Claude Mythos Preview以外のこれらすべてのモデルでは、メッセージは次のとおりです。

```text wrap
"thinking.type.disabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.
```

これらのモデルの中で唯一拡張思考を受け付けるClaude Mythos Previewでは、メッセージは次のとおりです。

```text wrap
"thinking.type.disabled" is not supported for this model. Thinking defaults to adaptive mode when not specified; use "thinking.type.enabled" with "budget_tokens" for extended thinking.
```

Claude Sonnet 5.5では、思考を`disabled`に設定することはできません。最も低い思考設定には`thinking: {"type": "between_tools"}`を使用してください。これにより事前の思考がオフになります。`thinking: {"type": "disabled"}`を送信すると、次のメッセージとともに400 `invalid_request_error`が返されます。

```text wrap
To turn thinking off on this model, send "thinking": {"type": "between_tools"} instead of {"type": "disabled"}. The model does not think before responding. The short updates it writes between tool calls come back as thinking blocks.
```

`xhigh`または`max`の[effort](https://platform.claude.com/docs/ja/build-with-claude/effort)では、`between_tools`を指定したリクエストも400 `invalid_request_error`を返します。`between_tools`には事前の思考がないため、メッセージでは思考が無効になっていると示されます。

```text wrap
output_config.effort 'xhigh' is not supported when thinking is disabled on this model. Use effort 'high' or below, or enable thinking.
```

`between_tools`では、会話の途中でeffortを変更できません。有効なレベルと異なるメッセージごとの`output_config.effort`を指定すると、400エラーが返されます。エラーには、新しいレベルを設定したメッセージの位置が示されます。

```text wrap
messages.N: output_config.effort 'low' differs from the 'high' in effect before it; effort cannot change when thinking is disabled on this model. Use effort 'high', or enable thinking.
```

Claude Haiku 5.5は`thinking: {"type": "disabled"}`を受け付け、`between_tools`に適用されるのと同じ2つのeffort制限を適用します。`xhigh`または`max`のeffortの場合、または有効なレベルと異なるメッセージごとの`output_config.effort`を指定した場合、リクエストは前述の対応するメッセージとともに400 `invalid_request_error`を返します。

どちらのメッセージでも、「enable thinking」は適応型思考を意味します。`thinking`フィールドを省略するか、`thinking: {"type": "adaptive"}`を送信してください。Claude Sonnet 5.5とClaude Haiku 5.5は`"enabled"`を400エラーで拒否します。ターンごとにeffortを変えるには、適応型思考を使用してください。

Claude Sonnet 5.5以外のモデルに`thinking: {"type": "between_tools"}`を送信すると、400 `invalid_request_error`が返されます。

```text wrap
"thinking.type.between_tools" is not supported for this model.
```

修正方法については、`between_tools`およびeffortのエラーを扱っている[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-type-between-tools)を参照してください。

`thinking`パラメータを省略すると、リクエストは適応型思考で実行されます。思考をオフにせずにレスポンスから思考の内容を除外するには、思考の設定で`display: "omitted"`を設定してください。[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-type-disabled)を参照してください。

### 強制的なツール使用はサポートされていません

Claude Opus 5.5、Claude Sonnet 5.5、Claude Fable 5.1、および[Claude Mythos 5.1](https://platform.claude.com/docs/ja/models/mythos-5-1/overview)は、強制的なツール使用をサポートしていません。[トークンカウントエンドポイント](https://platform.claude.com/docs/ja/build-with-claude/token-counting)を含め、これらのモデルのいずれかに`tool_choice: {"type": "any"}`または`tool_choice: {"type": "tool", "name": "..."}`を送信すると、400 `invalid_request_error`が返されます。

```text wrap
tool_choice: type "tool" and "any" are not supported for this model.
```

`tool_choice: {"type": "auto"}`（デフォルト）と`{"type": "none"}`は受け付けられます。ツールの入力をスキーマに準拠させるには`auto`を[厳密なツール使用](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/strict-tool-use)と組み合わせて使用し、レスポンス自体を固定のJSON形式にする必要がある場合は[構造化出力](https://platform.claude.com/docs/ja/build-with-claude/structured-outputs)を使用してください。[ツール使用の強制](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/define-tools#forcing-tool-use)を参照してください。

### コンピューター使用ツールのバージョンはサポートされていません

Claude APIおよびGoogle Cloudでは、Claude Opus 5.5、Claude Sonnet 5.5、Claude Haiku 5.5は、[コンピューター使用](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/computer-use-tool)を`computer_toolset_20260801`ツールセットとしてのみサポートします。これらのプラットフォームで、これらのモデルのいずれかに、以前の`computer_20251124`または`computer_20250124`タイプの`tools`エントリをそのツールのベータヘッダーとともに送信すると、400 `invalid_request_error`が返されます。メッセージには拒否されたタイプが示され、続いて`Did you mean one of`の後にモデルが受け付けるツールタイプが列挙されます。Claude Opus 5.5の場合、メッセージは次のように始まります。

```text wrap
'claude-opus-5-5' does not support tool types: computer_20251124.
```

APIは、リクエストされたモデルがサポートしていないAnthropic定義のツールタイプに対して同じメッセージを返します。ベータヘッダーなしで`{"type": "computer_toolset_20260801"}`を宣言し、[`computer_20251124`からの移行](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/computer-use-tool#migrate-from-computer-20251124)の説明に従ってエージェントループを更新してください。`computer_20250124`から移行するには、Claude Haiku 5.5移行ガイドの[コンピューター使用をツールセットに移行する](https://platform.claude.com/docs/ja/models/haiku-5-5/migration-guide#computer-use-toolset)を参照してください。ツールセットをサポートする以前のモデルは引き続き`computer_20251124`を受け付けます。Amazon Bedrock上のClaude Opus 5.5、Claude Sonnet 5.5、Claude Haiku 5.5も同様です。

### 思考ブロックが会話と一致しなくなりました

Claude Fable 5.1、Claude Opus 5.5、Claude Sonnet 5.5、Claude Haiku 5.5では、APIは、再送された思考ブロックより前にある`system`プロンプト、`tools`、およびメッセージが変更されていない場合にのみ、そのブロックを受け付けます。2026年8月31日以降に作成された新しいアカウント、および`thinking.block_binding.prefix_mismatch_behavior`を`"error"`に設定したリクエストでは、それ以前の履歴が変更された再送ブロックは400 `invalid_request_error`で拒否されます（`"drop_block"`の場合、APIはそのブロックを破棄し、リクエストは成功します）。メッセージは最初に失敗したブロックの位置で始まります。

```text wrap
messages.{i}.content.{j}: Invalid `signature` in `thinking` block. The block is bound to a different conversation. Remove the block, or set `thinking.block_binding.prefix_mismatch_behavior` to "drop_block".
```

`thinking-binding-controls-2026-08-01`ベータヘッダーがない場合、メッセージにはそのヘッダー名も示されます。会話履歴を追記のみにするか、ベータヘッダーを`prefix_mismatch_behavior: "drop_block"`とともに送信してブロックを破棄し、続行してください。Claude Sonnet 5.5とClaude Haiku 5.5では、`block_binding`は`thinking: {"type": "adaptive"}`でのみ機能します。Claude Sonnet 5.5で`between_tools`を使用する場合、またはClaude Haiku 5.5で`thinking: {"type": "disabled"}`を使用する場合は、履歴を追記のみにするか、編集したターン以降の思考ブロックを削除してください。対象モデルが読み取れないモデルからのブロックは、拒否されるのではなく破棄されます。[プレフィックスを変更しないようにする](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#prefix-check)および[思考のトラブルシューティング](https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting#error-thinking-block-signature)を参照してください。

`thinking-binding-controls-2026-08-01`[ベータヘッダー](https://platform.claude.com/docs/ja/api/beta-headers)なしで`thinking.block_binding`を送信すると、次の文で終わるメッセージとともに400 `invalid_request_error`が返されます。

```text wrap
block_binding: Extra inputs are not permitted
```

ヘッダーを追加するか、フィールドを削除してください。

### アウトバウンドWeb IDフェデレーションが無効（Claude Platform on AWS）

[Claude Platform on AWS](https://platform.claude.com/docs/ja/build-with-claude/claude-platform-on-aws)へのすべてのリクエストが`"Outbound web identity federation is disabled for your account"`を返す場合は、AWSアカウントごとに1回`aws iam enable-outbound-web-identity-federation`を実行してください。詳細については[アウトバウンドWeb IDフェデレーションの有効化](https://platform.claude.com/docs/ja/build-with-claude/claude-platform-on-aws#enable-outbound-web-identity-federation)を参照してください。

## 次のステップ

<CardGroup cols={3}>
  <Card title="思考のトラブルシューティング" icon="wrench" href="https://platform.claude.com/docs/ja/build-with-claude/thinking-troubleshooting">
    thinking設定の400エラー、空のthinkingブロック、`max_tokens`による停止に対する、症状から始める修正方法。
  </Card>

  <Card title="レート制限" icon="gauge" href="https://platform.claude.com/docs/ja/api/rate-limits">
    APIの悪用を軽減し容量を管理するため、組織がClaude APIを使用できる量には制限が設けられています。
  </Card>

  <Card title="ストリーミングメッセージ" icon="lightning" href="https://platform.claude.com/docs/ja/build-with-claude/streaming">
    テキスト、ツール使用、拡張思考のデルタを含むMessages APIレスポンスを、server-sent eventsで段階的にストリーミングします。
  </Card>
</CardGroup>
