---
title: Claude Sonnet 5.5移行ガイド
url: https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide
description: この移行ガイドを使用して、以前のSonnetモデルまたはClaude Haiku 4.5からClaude Sonnet 5.5に切り替えます。Claude Sonnet 5.5を有効にするためのガイダンスには、エラーを返す設定、思考の変更点、および開始モデルごとのチェックリストが含まれています。
---

このガイドでは、Claude Sonnet 5、Claude Sonnet 4.6、Claude Sonnet 4.5、Claude Sonnet 4、Claude 3.7 Sonnet、またはClaude Haiku 4.5からClaude Sonnet 5.5に移行するためのコード変更を説明します。最初の2つのセクションを読んでから、現在のモデルに対応するセクションまで読み進めてください。[移行チェックリスト](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migration-checklist)には、開始モデルごとにすべての変更点がまとめられています。

<Note>
  このガイドでは、[Messages API](https://platform.claude.com/docs/ja/build-with-claude/working-with-messages)のコードの移行について説明します。[Claude Managed Agents](https://platform.claude.com/docs/ja/managed-agents/overview)を使用している場合は、モデル名の更新以外に変更は必要ありません。
</Note>

Claude Codeにコードの移行を任せる

```text
/claude-api migrate このプロジェクトをclaude-sonnet-5-5に移行してください
```

Claude Sonnet 5.5の価格はClaude Sonnet 5と同じですが、プロンプトキャッシングのキャッシュ読み取りは例外で、100万トークンあたり0.10 USDと、Claude Sonnet 5の半額です。[料金](https://platform.claude.com/docs/ja/about-claude/pricing)を参照してください。「context window」（コンテキストウィンドウ）と出力の上限については、[Claude Sonnet 5.5](https://platform.claude.com/docs/ja/models/sonnet-5-5/overview)のモデルページを参照してください。機能とプロンプトについては、[Claude Sonnet 5.5の新機能](https://platform.claude.com/docs/ja/models/sonnet-5-5/whats-new-sonnet-5-5#feature-support)および[Claude Sonnet 5.5へのプロンプト](https://platform.claude.com/docs/ja/build-with-claude/prompt-engineering/prompting-claude-sonnet-5-5)を参照してください。

## Claude Sonnet 5.5にリクエストを送信する

このリクエストは、記述どおりにClaude Sonnet 5.5で動作します。「effort」（エフォート）レベルを設定しており、400エラーを返す5つの設定は含まれていません：[思考予算](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#sonnet-46-breaking-changes)、[サンプリングパラメータ](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#sonnet-46-breaking-changes)、[アシスタントのプレフィル](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migrating-from-sonnet-45)、[強制ツール選択](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#forced-tool-use)、および[`thinking: {"type": "disabled"}`](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)です。

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5-5",
      "max_tokens": 4096,
      "messages": [{
        "role": "user",
        "content": "Analyze the trade-offs between microservices and monolithic architectures"
      }],
      "output_config": {
        "effort": "medium"
      }
    }'
  ```

  ```bash CLI
  ant messages create \
    --model claude-sonnet-5-5 \
    --max-tokens 4096 \
    --output-config '{effort: medium}' \
    --message '{role: user, content: "Analyze the trade-offs between microservices and monolithic architectures"}'
  ```

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

  response = client.messages.create(
      model="claude-sonnet-5-5",
      max_tokens=4096,
      messages=[
          {
              "role": "user",
              "content": "Analyze the trade-offs between microservices and monolithic architectures",
          }
      ],
      output_config={"effort": "medium"},
  )

  print(f"Stop reason: {response.stop_reason}")
  for block in response.content:
      if block.type == "text":
          print(block.text)
  ```

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

  const response = await client.messages.create({
    model: "claude-sonnet-5-5",
    max_tokens: 4096,
    messages: [
      {
        role: "user",
        content: "Analyze the trade-offs between microservices and monolithic architectures"
      }
    ],
    output_config: {
      effort: "medium"
    }
  });

  console.log(`Stop reason: ${response.stop_reason}`);
  const textBlock = response.content.find((block) => block.type === "text");
  console.log(textBlock?.text);
  ```

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

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5_5,
      MaxTokens = 4096,
      Messages = [
          new UserMessageParam
          {
              Content = "Analyze the trade-offs between microservices and monolithic architectures"
          }
      ],
      OutputConfig = new OutputConfig
      {
          Effort = Effort.Medium
      }
  };

  var message = await client.Messages.Create(parameters);
  Console.WriteLine($"Stop reason: {message.StopReason?.Raw()}");
  foreach (var block in message.Content)
  {
      if (block.TryPickText(out var textBlock))
      {
          Console.WriteLine(textBlock.Text);
      }
  }
  ```

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

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet5_5,
  	MaxTokens: 4096,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Analyze the trade-offs between microservices and monolithic architectures")),
  	},
  	OutputConfig: anthropic.OutputConfigParam{
  		Effort: anthropic.OutputConfigEffortMedium,
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println("Stop reason:", response.StopReason)
  for _, block := range response.Content {
  	if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
  		fmt.Println(textBlock.Text)
  	}
  }
  ```

  ```java Java
  import com.anthropic.models.messages.OutputConfig;

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

      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_SONNET_5_5)
          .maxTokens(4096L)
          .addUserMessage("Analyze the trade-offs between microservices and monolithic architectures")
          .outputConfig(OutputConfig.builder()
              .effort(OutputConfig.Effort.MEDIUM)
              .build())
          .build();

      Message response = client.messages().create(params);
      response.stopReason().ifPresent(reason -> IO.println("Stop reason: " + reason));
      response.content().stream()
          .flatMap(block -> block.text().stream())
          .forEach(textBlock -> IO.println(textBlock.text()));
  }
  ```

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

  $message = $client->messages->create(
      maxTokens: 4096,
      messages: [
          ['role' => 'user', 'content' => 'Analyze the trade-offs between microservices and monolithic architectures']
      ],
      model: Model::CLAUDE_SONNET_5_5,
      outputConfig: ['effort' => 'medium'],
  );

  echo "Stop reason: {$message->stopReason}", PHP_EOL;
  foreach ($message->content as $block) {
      if ($block instanceof \Anthropic\Messages\TextBlock) {
          echo $block->text, PHP_EOL;
      }
  }
  ```

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

  message = client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5_5,
    max_tokens: 4096,
    messages: [
      { role: "user", content: "Analyze the trade-offs between microservices and monolithic architectures" }
    ],
    output_config: {
      effort: "medium"
    }
  )

  puts "Stop reason: #{message.stop_reason}"
  message.content.each do |block|
    puts block.text if block.is_a?(Anthropic::Models::TextBlock)
  end
  ```
</CodeGroup>

## 思考はデフォルトで実行される

Claude Sonnet 5.5では、`thinking`フィールドのないリクエストは、`thinking: {"type": "adaptive"}`と同様に、[「adaptive thinking」（適応型思考）](https://platform.claude.com/docs/ja/build-with-claude/thinking)で実行されます。Claude Sonnet 4.6以前のモデルおよびClaude Haiku 4.5では、このリクエストは思考なしで実行されていました。事前の思考なしで実行し続けるには、[事前の思考をオフにする](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)を参照してください。

| モデル                                  | `thinking`フィールドなしの場合の思考 | 受け付けられる`thinking.type`の値                   | デフォルトの`display` |
| ------------------------------------ | ----------------------- | ------------------------------------------ | --------------- |
| Claude Sonnet 5.5                    | オン                      | `"adaptive"`、`"between_tools"`             | `"omitted"`     |
| Claude Sonnet 5                      | オン                      | `"adaptive"`、`"disabled"`                  | `"omitted"`     |
| Claude Sonnet 4.6                    | オフ                      | `"adaptive"`、`"disabled"`、`"enabled"`（非推奨） | `"summarized"`  |
| Claude Sonnet 4.5およびClaude Haiku 4.5 | オフ                      | `"disabled"`、`"enabled"`                   | `"summarized"`  |

### 応答内の思考を処理する

思考なしで実行していたコードには、3つの項目すべてが必要です。Claude Sonnet 5からのコードには、おそらく最初の2つがすでに含まれています。

* **コンテンツブロックを`type`で読み取る。** 応答は`thinking`ブロックで始まる場合があるため、`content[0].text`を読み取るコードは動作しなくなります。
* **`thinking`ブロックを変更せずにそのまま返す。** ツール使用ループでは、空のものも含めて返します。[思考ブロックの保持](https://platform.claude.com/docs/ja/build-with-claude/thinking#preserving-thinking-blocks)を参照してください。
* **`max_tokens`を見直す。** これは思考とテキストの両方をカバーし、思考トークンは出力トークンとして課金されます。[コスト管理](https://platform.claude.com/docs/ja/build-with-claude/thinking-steering-and-cost#cost-control)を参照してください。

思考テキストはデフォルトで省略されます。`thinking`ブロックは、空の`thinking`フィールドと`signature`を伴って届きます。読み取り可能な要約を取得するには、`display: "summarized"`を設定します。これはClaude Sonnet 4.6以前のモデルおよびClaude Haiku 4.5でのデフォルトです。[思考表示の制御](https://platform.claude.com/docs/ja/build-with-claude/thinking#controlling-thinking-display)を参照してください。

### 事前の思考をオフにする

Claude Sonnet 5.5で事前の思考をオフにするには、`thinking: {"type": "between_tools"}`を送信します。これは最も低い思考設定です。ツール呼び出し間の進捗更新は、引き続き要約テキスト付きの`thinking`ブロックとして返されます。ツールがない場合、応答にはテキストのみが含まれます。Claude Sonnet 5では代わりに`thinking: {"type": "disabled"}`で思考をオフにし、それ以前のモデルはデフォルトで思考なしで実行されます。Claude Sonnet 5.5では、`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.
```

`between_tools`は、Claude Sonnet 5.5を提供するすべてのプラットフォームで動作します。`low`、`medium`、`high`のエフォートで受け付けられます。`xhigh`または`max`では400エラーを返します。これらのレベルで実行するには、適応型思考を使用してください：`thinking`フィールドを省略するか、`thinking: {"type": "adaptive"}`を送信します。`between_tools`は他のフィールドを受け付けません：`display`、`budget_tokens`、または`block_binding`を一緒に送信すると400エラーを返します。[サーバーサイドフォールバック](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback#server-side-fallback)を使用する場合、Claude Sonnet 5にフォールバックした`between_tools`リクエストは、そちらで`thinking: {"type": "disabled"}`として実行されます。

`between_tools`を使用する場合、エフォートを会話の途中で変更することはできません：有効なレベルと異なるメッセージごとの`output_config.effort`は400エラーを返します。ターンごとにエフォートを変えるには、適応型思考を使用してください。プロンプトのガイダンスについては、[事前の思考なしでの実行](https://platform.claude.com/docs/ja/build-with-claude/prompt-engineering/prompting-claude-sonnet-5-5#running-without-up-front-thinking)を参照してください。

変更前（Claude Sonnet 5）：

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5",
      "max_tokens": 16000,
      "thinking": {"type": "disabled"},
      "output_config": {"effort": "xhigh"},
      "messages": [{"role": "user", "content": "..."}]
    }'
  ```

  ```bash CLI
  ant messages create \
    --model claude-sonnet-5 \
    --max-tokens 16000 \
    --thinking '{type: disabled}' \
    --output-config '{effort: xhigh}' \
    --message '{role: user, content: "..."}'
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-5",
      max_tokens=16000,
      thinking={"type": "disabled"},
      output_config={"effort": "xhigh"},
      messages=[{"role": "user", "content": "..."}],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-5",
    max_tokens: 16000,
    thinking: { type: "disabled" },
    output_config: { effort: "xhigh" },
    messages: [{ role: "user", content: "..." }]
  });
  ```

  ```csharp C#
  await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5,
      MaxTokens = 16000,
      Thinking = new ThinkingConfigDisabled(),
      OutputConfig = new() { Effort = Effort.Xhigh },
      Messages = [new UserMessageParam { Content = "..." }],
  });
  ```

  ```go Go
  client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet5,
  	MaxTokens: 16000,
  	Thinking: anthropic.ThinkingConfigParamUnion{
  		OfDisabled: &anthropic.ThinkingConfigDisabledParam{},
  	},
  	OutputConfig: anthropic.OutputConfigParam{
  		Effort: anthropic.OutputConfigEffortXhigh,
  	},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("...")),
  	},
  })
  ```

  ```java Java
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_5)
      .maxTokens(16000L)
      .thinking(ThinkingConfigDisabled.builder().build())
      .outputConfig(OutputConfig.builder()
          .effort(OutputConfig.Effort.XHIGH)
          .build())
      .addUserMessage("...")
      .build();

  client.messages().create(params);
  ```

  ```php PHP
  $client->messages->create(
      model: Model::CLAUDE_SONNET_5,
      maxTokens: 16000,
      thinking: ThinkingConfigDisabled::with(),
      outputConfig: OutputConfig::with(effort: Effort::XHIGH),
      messages: [['role' => 'user', 'content' => '...']],
  );
  ```

  ```ruby Ruby
  client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5,
    max_tokens: 16000,
    thinking: Anthropic::ThinkingConfigDisabled.new,
    output_config: { effort: Anthropic::OutputConfig::Effort::XHIGH },
    messages: [{ role: "user", content: "..." }]
  )
  ```
</CodeGroup>

変更後（Claude Sonnet 5.5）：

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5-5",
      "max_tokens": 16000,
      "thinking": {"type": "between_tools"},
      "output_config": {"effort": "high"},
      "messages": [{"role": "user", "content": "..."}]
    }'
  ```

  ```bash CLI
  ant messages create \
    --model claude-sonnet-5-5 \
    --max-tokens 16000 \
    --thinking '{type: between_tools}' \
    --output-config '{effort: high}' \
    --message '{role: user, content: "..."}'
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-5-5",
      max_tokens=16000,
      thinking={"type": "between_tools"},
      output_config={"effort": "high"},
      messages=[{"role": "user", "content": "..."}],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-5-5",
    max_tokens: 16000,
    thinking: { type: "between_tools" },
    output_config: { effort: "high" },
    messages: [{ role: "user", content: "..." }]
  });
  ```

  ```csharp C#
  await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5_5,
      MaxTokens = 16000,
      Thinking = new ThinkingConfigBetweenTools(),
      OutputConfig = new() { Effort = Effort.High },
      Messages = [new UserMessageParam { Content = "..." }],
  });
  ```

  ```go Go
  client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet5_5,
  	MaxTokens: 16000,
  	Thinking: anthropic.ThinkingConfigParamUnion{
  		OfBetweenTools: &anthropic.ThinkingConfigBetweenToolsParam{},
  	},
  	OutputConfig: anthropic.OutputConfigParam{
  		Effort: anthropic.OutputConfigEffortHigh,
  	},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("...")),
  	},
  })
  ```

  ```java Java
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_5_5)
      .maxTokens(16000L)
      .thinking(ThinkingConfigBetweenTools.builder().build())
      .outputConfig(OutputConfig.builder()
          .effort(OutputConfig.Effort.HIGH)
          .build())
      .addUserMessage("...")
      .build();

  client.messages().create(params);
  ```

  ```php PHP
  $client->messages->create(
      model: Model::CLAUDE_SONNET_5_5,
      maxTokens: 16000,
      thinking: ThinkingConfigBetweenTools::with(),
      outputConfig: OutputConfig::with(effort: Effort::HIGH),
      messages: [['role' => 'user', 'content' => '...']],
  );
  ```

  ```ruby Ruby
  client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5_5,
    max_tokens: 16000,
    thinking: Anthropic::ThinkingConfigBetweenTools.new,
    output_config: { effort: Anthropic::OutputConfig::Effort::HIGH },
    messages: [{ role: "user", content: "..." }]
  )
  ```
</CodeGroup>

## 開始モデル別の移行チェックリスト

グループを上から順に進め、ご自身のモデル名が記載されたグループで終了してください。Claude Haiku 4.5の場合は、「Claude Sonnet 4以前」を除くすべてのグループを適用し、「Claude Haiku 4.5のみ」で終了します。

### すべての開始モデル

* モデルIDを`claude-sonnet-5-5`に変更します。
* [コンテンツブロックを`type`で読み取り](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-in-responses)、`thinking`ブロックは変更せずにそのまま返します。
* 事前の思考なしで実行し続けるには、`high`以下のエフォートで[最も低い思考設定](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)を送信します。
* [強制ツール使用](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#forced-tool-use)を`auto`とstrictツールに置き換えます。
* 会話を[追記のみ](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-blocks)に保ちます。
* コンピューター使用を`fine-grained-tool-streaming-2025-05-14`ベータヘッダーなしで[ツールセット](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#computer-use-toolset)に移行します。Amazon Bedrockでは、`computer_20251124`も動作します。
* [アドバイザーツールをサポートされているアドバイザーと組み合わせ](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#advisor-tool)、暗号化されたアドバイスが返されることを想定してください。
* [ツール呼び出し間のテキスト](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#text-between-tool-calls)は`thinking`ブロックから読み取ります。
* [拒否を処理し](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#safety-classifiers-and-fallback)、フォールバックを設定します。
* [エフォートの比較検証を再実行し](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#recommended-changes)、コストのベースラインを再設定します。

### Claude Sonnet 4.6以前

* [`thinking`フィールドのないリクエストでの思考](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-on-by-default)を想定し、`max_tokens`を見直します。
* [思考予算](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#sonnet-46-breaking-changes)をエフォートレベルに置き換えます。
* `temperature`、`top_p`、`top_k`を削除します。
* [思考テキストを表示する](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-in-responses)場合は、`display: "summarized"`を設定します。
* [トークンを再カウントし](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#other-changes-from-claude-sonnet-4-6)、画像トークンの予算を再設定します。

### Claude Sonnet 4.5以前

* [アシスタントのプレフィル](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migrating-from-sonnet-45)を置き換えます。
* ツール呼び出しの入力は標準のJSONパーサーで解析します。
* `output_config.effort`を明示的に設定します。
* コンテキストウィンドウ関連のベータヘッダーをすべて削除します。
* `interleaved-thinking-2025-05-14`を削除し、`fine-grained-tool-streaming-2025-05-14`を`eager_input_streaming`に置き換えます。
* `output_format`を`output_config.format`に移動します。

### Claude Sonnet 4以前

* [ツールバージョン](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migrating-from-claude-sonnet-4-or-earlier)を`text_editor_20250728`および`code_execution_20260521`に更新します。
* `refusal`および`model_context_window_exceeded`の停止理由を処理します。
* ツールの文字列パラメータの末尾の改行を確認します。
* `token-efficient-tools-2025-02-19`および`output-128k-2025-02-19`を削除します。
* プロンプトを見直します。

### Claude Haiku 4.5のみ

* [`claude-haiku-4-5-20251001`](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migrating-from-claude-haiku-4-5)またはそのエイリアスを置き換えます。
* トークンあたりの価格が高くなるため、コストのベースラインを再設定します。
* Claude Haiku 4.5ではキャッシュするには短すぎたプロンプトを見直します。

## Claude Sonnet 5からClaude Sonnet 5.5への移行

すべての開始モデルで、このセクションの変更が必要です。モデルIDを、日付サフィックスのない`claude-sonnet-5-5`に置き換えます。他のプラットフォームでは、[利用可能性](https://platform.claude.com/docs/ja/models/sonnet-5-5/whats-new-sonnet-5-5#availability)に記載されているIDを使用してください。

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

このページに記載されているそれ以前のすべてのモデルは、タイプ`any`または`tool`の`tool_choice`を受け付けます。Claude Sonnet 5.5は、[トークンカウント](https://platform.claude.com/docs/ja/build-with-claude/token-counting)エンドポイントを含め、両方を400エラーで拒否します：

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

`tool_choice: {"type": "auto"}`を送信し、入力がスキーマに一致するようにツールに`strict: true`を指定します。この場合、モデルはツールを呼び出さずに回答できるため、いつツールを使用するかをプロンプトで指示してください。[Strictツール使用](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/strict-tool-use)はJSON Schemaのサブセットをサポートし、すべてのオブジェクトに`additionalProperties: false`が必要です。[JSON Schemaの制限](https://platform.claude.com/docs/ja/build-with-claude/structured-outputs#json-schema-limitations)を参照してください。

変更前（Claude Sonnet 5）：

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5",
      "max_tokens": 1024,
      "tools": [{
        "name": "get_weather",
        "description": "Get the current weather in a given location",
        "input_schema": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            }
          },
          "required": ["location"],
          "additionalProperties": false
        }
      }],
      "tool_choice": {"type": "tool", "name": "get_weather"},
      "messages": [{"role": "user", "content": "What is the weather in Paris?"}]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-sonnet-5
  max_tokens: 1024
  tools:
    - name: get_weather
      description: Get the current weather in a given location
      input_schema:
        type: object
        properties:
          location:
            type: string
            description: The city and state, e.g. San Francisco, CA
        required: [location]
        additionalProperties: false
  tool_choice:
    type: tool
    name: get_weather
  messages:
    - role: user
      content: What's the weather in Paris?
  YAML
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-5",
      max_tokens=1024,
      tools=tools,
      tool_choice={"type": "tool", "name": "get_weather"},
      messages=[{"role": "user", "content": "What's the weather in Paris?"}],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-5",
    max_tokens: 1024,
    tools,
    tool_choice: { type: "tool", name: "get_weather" },
    messages: [{ role: "user", content: "What's the weather in Paris?" }]
  });
  ```

  ```csharp C#
  await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5,
      MaxTokens = 1024,
      Tools = [.. tools],
      ToolChoice = new ToolChoiceTool { Name = "get_weather" },
      Messages = [new UserMessageParam { Content = "What's the weather in Paris?" }],
  });
  ```

  ```go Go
  client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:      anthropic.ModelClaudeSonnet5,
  	MaxTokens:  1024,
  	Tools:      tools,
  	ToolChoice: anthropic.ToolChoiceParamOfTool("get_weather"),
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in Paris?")),
  	},
  })
  ```

  ```java Java
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_5)
      .maxTokens(1024L)
      .tools(tools)
      .toolChoice(ToolChoiceTool.of("get_weather"))
      .addUserMessage("What's the weather in Paris?")
      .build();

  client.messages().create(params);
  ```

  ```php PHP
  $client->messages->create(
      model: Model::CLAUDE_SONNET_5,
      maxTokens: 1024,
      tools: $tools,
      toolChoice: ToolChoiceTool::with(name: 'get_weather'),
      messages: [['role' => 'user', 'content' => "What's the weather in Paris?"]],
  );
  ```

  ```ruby Ruby
  client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5,
    max_tokens: 1024,
    tools: tools,
    tool_choice: Anthropic::ToolChoiceTool.new(name: "get_weather"),
    messages: [{ role: "user", content: "What's the weather in Paris?" }]
  )
  ```
</CodeGroup>

変更後（Claude Sonnet 5.5）：

<CodeGroup>
  ```bash cURL
  # strict tool use（厳格なツール使用）: すべての呼び出しがツールの input_schema に一致します
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5-5",
      "max_tokens": 1024,
      "tools": [{
        "name": "get_weather",
        "description": "Get the current weather in a given location",
        "input_schema": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            }
          },
          "required": ["location"],
          "additionalProperties": false
        },
        "strict": true
      }],
      "tool_choice": {"type": "auto"},
      "messages": [{
        "role": "user",
        "content": "What is the weather in Paris? Use the get_weather tool."
      }]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-sonnet-5-5
  max_tokens: 1024
  tools:
    - name: get_weather
      description: Get the current weather in a given location
      input_schema:
        type: object
        properties:
          location:
            type: string
            description: The city and state, e.g. San Francisco, CA
        required: [location]
        additionalProperties: false
      # strict tool use（厳格なツール使用）: すべての呼び出しがツールの input_schema に一致します
      strict: true
  tool_choice:
    type: auto
  messages:
    - role: user
      content: What's the weather in Paris? Use the get_weather tool.
  YAML
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-5-5",
      max_tokens=1024,
      # strict tool use（厳格なツール使用）: すべての呼び出しがツールの input_schema に一致します
      tools=[{**tool, "strict": True} for tool in tools],
      tool_choice={"type": "auto"},
      messages=[
          {
              "role": "user",
              "content": "What's the weather in Paris? Use the get_weather tool.",
          }
      ],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-5-5",
    max_tokens: 1024,
    // strict なツール使用: すべての呼び出しがツールの input_schema に一致します
    tools: tools.map((tool) => ({ ...tool, strict: true })),
    tool_choice: { type: "auto" },
    messages: [
      {
        role: "user",
        content: "What's the weather in Paris? Use the get_weather tool."
      }
    ]
  });
  ```

  ```csharp C#
  await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5_5,
      MaxTokens = 1024,
      // strict tool use（厳格なツール使用）：すべての呼び出しがツールの input_schema に一致します
      Tools = [.. tools.Select(tool => tool with { Strict = true })],
      ToolChoice = new ToolChoiceAuto(),
      Messages =
      [
          new UserMessageParam
          {
              Content = "What's the weather in Paris? Use the get_weather tool.",
          },
      ],
  });
  ```

  ```go Go
  // strict なツール使用: すべての呼び出しがツールの input_schema に一致します
  var strictTools []anthropic.ToolUnionParam
  for _, tool := range tools {
  	strictTool := *tool.OfTool
  	strictTool.Strict = anthropic.Bool(true)
  	strictTools = append(strictTools, anthropic.ToolUnionParam{OfTool: &strictTool})
  }
  client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:      anthropic.ModelClaudeSonnet5_5,
  	MaxTokens:  1024,
  	Tools:      strictTools,
  	ToolChoice: anthropic.ToolChoiceUnionParam{OfAuto: &anthropic.ToolChoiceAutoParam{}},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.NewTextBlock("What's the weather in Paris? Use the get_weather tool."),
  		),
  	},
  })
  ```

  ```java Java
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_5_5)
      .maxTokens(1024L)
      // strict なツール使用: すべての呼び出しがツールの input_schema に一致します
      .tools(tools.stream()
          .map(tool -> tool.tool()
              .map(customTool -> customTool.toBuilder()
                  .strict(true)
                  .build())
              .map(ToolUnion::ofTool)
              .orElse(tool))
          .toList())
      .toolChoice(ToolChoiceAuto.builder().build())
      .addUserMessage("What's the weather in Paris? Use the get_weather tool.")
      .build();

  client.messages().create(params);
  ```

  ```php PHP
  $client->messages->create(
      model: Model::CLAUDE_SONNET_5_5,
      maxTokens: 1024,
      // strict なツール使用: すべての呼び出しがツールの input_schema に一致します
      tools: array_map(fn (Tool $tool) => $tool->withStrict(true), $tools),
      toolChoice: ToolChoiceAuto::with(),
      messages: [
          [
              'role' => 'user',
              'content' => "What's the weather in Paris? Use the get_weather tool.",
          ],
      ],
  );
  ```

  ```ruby Ruby
  client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5_5,
    max_tokens: 1024,
    # strict なツール使用: すべての呼び出しがツールの input_schema に一致します
    tools: tools.map { |tool| tool.merge(strict: true) },
    tool_choice: Anthropic::ToolChoiceAuto.new,
    messages: [
      { role: "user", content: "What's the weather in Paris? Use the get_weather tool." }
    ]
  )
  ```
</CodeGroup>

この例では、リスト内のすべてのツールをstrictに指定しています。1つのリクエストに含められるstrictツールは最大20個で、MCP、コンピューター使用、ブラウザ使用のツールセットエントリは`strict`を受け付けません。より長いツールリストでは、必要なツールのみを指定してください。

### 思考ブロックはモデルと会話に紐付けられる

Claude Sonnet 5.5は、Claude Sonnet 5、Claude Opus 4.8、Claude Haiku 4.5、および[それ以前のモデル](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#earlier-models)からの思考ブロックを読み取ります。また、Claude APIおよびClaude Models on Google Cloud (Google managed)では、Claude Haiku 5.5からの思考ブロックも読み取ります。Claude Opus 5、Claude Opus 5.5、またはClaude FableやClaude Mythosのいずれのモデルからのブロックも読み取りません。

APIは、モデルが読み取れないブロックを除外します。リクエストは200を返し、除外されたブロックは課金されません。[モデルを切り替えて元に戻す](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#switching-models)を参照してください。

思考ブロックが[プレフィックスチェック](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking/prefix-checks#prefix-check)に合格するように、会話は追記のみで進めてください。指示やツールを変更するには、[会話途中のシステムメッセージとツールの変更](https://platform.claude.com/docs/ja/build-with-claude/mid-conversation-system-messages)を参照してください。

[プレフィックスチェック](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking/prefix-checks#prefix-check)に失敗すると、[400エラー](https://platform.claude.com/docs/ja/api/errors#thinking-block-conversation-mismatch)になる場合もあれば、ならない場合もあります。両方のケースを特定して対処するには、[思考ブロックのプレフィックスチェック](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking/prefix-checks)を参照してください。

プレフィックスチェックは、Claude APIおよび[一部のクラウドプラットフォーム](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#feature-availability)で実行されます。

Claude Sonnet 5.5の思考ブロックは、それを生成したアカウント、またはそのアカウントにリンクされたアカウントでのみ機能します。[保持された思考](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#account-bound-thinking)を参照してください。

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

Claude Sonnet 5.5は、`computer_toolset_20260801`ツールセットを通じてコンピューター使用をサポートします。Amazon Bedrockでは、Claude Sonnet 5.5は`computer-use-2025-11-24`ベータヘッダー付きの`computer_20251124`ツールも受け付けます。Claude Sonnet 5.5は、Claude APIでの`computer_20251124`など、受け付けないコンピューター使用ツールバージョンに対しては400エラーを返します。`computer_20250124`はどのプラットフォームでも受け付けません。

ツールセットを使用している統合は変更不要です。ツールセットに移行するには、`computer_20251124`または`computer_20250124`を`computer_toolset_20260801`に置き換え、そのバージョンのベータヘッダーを削除します。リクエストとエージェントループの変更点については、[`computer_20251124`からの移行](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/computer-use-tool#migrate-from-computer-20251124)を参照してください。

`fine-grained-tool-streaming-2025-05-14`ベータヘッダーを送信している場合は、ツールセットに移行する際に削除してください。ツールセットエントリと一緒に送信すると400エラーを返します。代わりに、必要な各ツールに`eager_input_streaming: true`を設定してください。

### アドバイザーツールで受け付けられるアドバイザーが少なくなる

[アドバイザーツール](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/advisor-tool)を使用する場合、Claude Sonnet 5.5のエグゼキューターには次のいずれかのアドバイザーが必要です：Claude Opus 5、Claude Opus 5.5、Claude Sonnet 5.5、Claude Fable 5、Claude Fable 5.1、Claude Fable 5.2、Claude Mythos 5、Claude Mythos 5.1、またはClaude Mythos 5.2。Claude Opus 4.8、Claude Opus 4.7、Claude Opus 4.6、Claude Sonnet 5、Claude Sonnet 4.6、およびClaude Haiku 5.5のアドバイザーは400エラーを返します。アドバイスは`advisor_redacted_result`ブロックとして暗号化されて返されるため、そのテキストは応答内で読み取ることはできません。[モデルの互換性](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/advisor-tool#model-compatibility)を参照してください。

### ツール呼び出し間のテキストは思考ブロックで返される

Claude Sonnet 5.5では、モデルがツール呼び出しの間に書く1〜2文より長いメモは、[進捗更新の`thinking`ブロック](https://platform.claude.com/docs/ja/build-with-claude/thinking#progress-updates)として返され、デフォルトの`display`では空になります。それより短い発言は`text`のままです。Claude Sonnet 5以前のモデルでは、ツール呼び出し間のすべてのテキストが`text`ブロックとして返されます。失敗するリクエストはありませんが、それらのメモを表示するインターフェースではメモが表示されなくなります。

適応型思考では、`display`を`"updates"`（ベータ、`thinking-display-updates-2026-08-18`ヘッダー）に設定すると更新のみを取得でき、`"summarized"`に設定すると推論と混在した形で取得できます。空でない各`thinking`ブロックは、それに続く`tool_use`ブロックの前にレンダリングしてください。[`between_tools`](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)では、テキストは`display`なしで返されます。[ユーザー向けの進捗更新](https://platform.claude.com/docs/ja/build-with-claude/prompt-engineering/prompting-claude-sonnet-5-5#user-facing-progress-updates)を参照してください。

### 安全性分類器とフォールバック

Claude Sonnet 5.5は、Claude Sonnet 5よりも多くのカテゴリで応答を拒否します。拒否は`stop_reason: "refusal"`を返し、その`stop_details`には次のいずれかの[カテゴリ](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback#refusal-response)が示される場合があります：

* **`"cyber"`：** リクエストが、マルウェアやエクスプロイトの開発など、サイバー被害を可能にする可能性があります。
* **`"bio"`：** リクエストが、危険な実験手法など、生物学的被害を可能にする可能性があります。
* **`"frontier_llm"`：** リクエストが、競合するAIモデルの開発を支援する可能性があります。
* **`"reasoning_extraction"`：** リクエストが、モデルの内部推論を応答テキストで再現するよう求めています。
* **`"general_harms"`：** リクエストが、その他の利用ポリシー領域に該当します。無害な作業でもこのカテゴリがトリガーされる場合があります。

Claude APIおよび[Claude Models on Google Cloud (Anthropic managed)](https://platform.claude.com/docs/ja/build-with-claude/claude-models-on-google-cloud/anthropic-managed)でベータ版として提供されている[サーバーサイドフォールバック](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback#server-side-fallback)（`fallbacks: "default"`）は、`"cyber"`および`"frontier_llm"`の拒否をClaude Sonnet 5で再試行します。`"bio"`、`"reasoning_extraction"`、または`"general_harms"`の拒否は再試行しません。[拒否とフォールバック](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback)および[拒否の課金方法](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback#how-refusals-are-billed)を参照してください。

リアルタイムのサイバーセーフガードは、Claude Sonnet 4.6、Claude Sonnet 4.5、およびClaude Haiku 4.5からのコードにとっては新しいものです。正当なセキュリティ作業については、[Cyber Verification Program](https://support.claude.com/en/articles/14604842-real-time-cyber-safeguards-on-claude-opus-and-sonnet)に申請してください。

### その他の変更

* **「prompt caching」（プロンプトキャッシング）：** キャッシュ可能なプロンプトの最小サイズは512トークンで、Claude Sonnet 5、Claude Sonnet 4.6、Claude Sonnet 4.5の1,024から引き下げられました。[プロンプトキャッシング](https://platform.claude.com/docs/ja/build-with-claude/prompt-caching#cache-limitations)を参照してください。
* **新機能：** 会話途中のシステムメッセージ、会話途中のツール変更、メッセージごとのエフォートについては、[Claude Sonnet 5.5の新機能](https://platform.claude.com/docs/ja/models/sonnet-5-5/whats-new-sonnet-5-5#feature-support)を参照してください。[`between_tools`](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)では、エフォートを会話の途中で変更することはできません。

### 推奨される変更

エフォートの比較検証を再実行してください。Claude Sonnet 5.5には5つのエフォートレベルがあります：`low`、`medium`、`high`、`xhigh`、`max`。Claude APIでのデフォルトは`high`です。レベルは再調整されているため、同じレベルでもClaude Sonnet 5と同じ量の思考が生成されるわけではありません。ワークロードがエージェント型またはレイテンシに敏感なものでない限り、`high`から始めてください。エージェント型のコーディングや複数ステップのツール使用では、仕様が明確なタスクには`medium`から始め、より難しいタスクや長いタスクには`high`に移行してください。チャットやその他のレイテンシに敏感な作業では、`medium`または`low`から始めてください。レベルは`output_config.effort`で設定します。[Claude Sonnet 5.5の推奨エフォートレベル](https://platform.claude.com/docs/ja/build-with-claude/effort#recommended-effort-levels-for-claude-sonnet-5-5)を参照してください。その後、モデル固有のプロンプト指示を[Claude Sonnet 5.5へのプロンプト](https://platform.claude.com/docs/ja/build-with-claude/prompt-engineering/prompting-claude-sonnet-5-5)に照らして再評価してください。

## Claude Sonnet 4.6以前のSonnetモデルからClaude Sonnet 5.5への移行

まず、`claude-sonnet-4-6`を置き換えて、前述のすべてのセクションを適用します。その後、以下の変更を行います。Claude Sonnet 4.5以前の場合は、続くサブセクションに進んでください。

### 破壊的変更

**思考を省略していたリクエストでも思考が実行される。** [思考はデフォルトで実行される](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-on-by-default)および[事前の思考をオフにする](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#turn-off-up-front-thinking)を参照してください。

**思考予算はエラーを返す。** Claude Sonnet 4.6は、`thinking: {"type": "enabled", "budget_tokens": N}`を非推奨の設定として受け付けます。Claude Sonnet 4.5およびClaude Haiku 4.5は、すべての思考にこれを使用します。Claude Sonnet 5.5は400エラーを返します：

```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/effort)レベルを設定してください。予算からエフォートレベルへの固定的な対応関係はないため、2つか3つのレベルで評価を実行してください。

変更前（Claude Sonnet 4.6）：

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-4-6",
      "max_tokens": 16000,
      "thinking": {
        "type": "enabled",
        "budget_tokens": 10000
      },
      "messages": [
        {
          "role": "user",
          "content": "..."
        }
      ]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-sonnet-4-6
  max_tokens: 16000
  thinking:
    type: enabled
    budget_tokens: 10000
  messages:
    - role: user
      content: "..."
  YAML
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-4-6",
      max_tokens=16000,
      thinking={"type": "enabled", "budget_tokens": 10000},
      messages=[{"role": "user", "content": "..."}],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-4-6",
    max_tokens: 16000,
    thinking: { type: "enabled", budget_tokens: 10000 },
    messages: [{ role: "user", content: "..." }]
  });
  ```

  ```csharp C#
  using Anthropic;
  using Anthropic.Models.Messages;

  AnthropicClient client = new();

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeSonnet4_6,
      MaxTokens = 16000,
      Thinking = new ThinkingConfigEnabled(budgetTokens: 10000),
      Messages = [new UserMessageParam { Content = "..." }]
  };

  var response = await client.Messages.Create(parameters);
  Console.WriteLine(response);
  ```

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

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet4_6,
  	MaxTokens: 16000,
  	Thinking:  anthropic.ThinkingConfigParamOfEnabled(10000),
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("...")),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_4_6)
      .maxTokens(16000L)
      .enabledThinking(10000L)
      .addUserMessage("...")
      .build();

  Message response = client.messages().create(params);
  IO.println(response);
  ```

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

  $message = $client->messages->create(
      maxTokens: 16000,
      messages: [['role' => 'user', 'content' => '...']],
      model: Model::CLAUDE_SONNET_4_6,
      thinking: ['type' => 'enabled', 'budgetTokens' => 10000],
  );
  ```

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

  message = client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_4_6,
    max_tokens: 16000,
    thinking: {
      type: "enabled",
      budget_tokens: 10000
    },
    messages: [
      { role: "user", content: "..." }
    ]
  )
  ```
</CodeGroup>

変更後（Claude Sonnet 5.5）：

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-sonnet-5-5",
      "max_tokens": 16000,
      "thinking": {
        "type": "adaptive"
      },
      "output_config": {
        "effort": "high"
      },
      "messages": [
        {
          "role": "user",
          "content": "..."
        }
      ]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-sonnet-5-5
  max_tokens: 16000
  thinking:
    type: adaptive
  output_config:
    effort: high
  messages:
    - role: user
      content: "..."
  YAML
  ```

  ```python Python
  client.messages.create(
      model="claude-sonnet-5-5",
      max_tokens=16000,
      thinking={"type": "adaptive"},
      output_config={"effort": "high"},  # or "max", "xhigh", "medium", "low"
      messages=[{"role": "user", "content": "..."}],
  )
  ```

  ```typescript TypeScript
  await client.messages.create({
    model: "claude-sonnet-5-5",
    max_tokens: 16000,
    thinking: { type: "adaptive" },
    output_config: { effort: "high" }, // or "max", "xhigh", "medium", "low"
    messages: [{ role: "user", content: "..." }]
  });
  ```

  ```csharp C#
  using Anthropic;
  using Anthropic.Models.Messages;

  AnthropicClient client = new();

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5_5,
      MaxTokens = 16000,
      Thinking = new ThinkingConfigAdaptive(),
      OutputConfig = new OutputConfig { Effort = Effort.High }, // or Max, Xhigh, Medium, Low
      Messages = [new UserMessageParam { Content = "..." }]
  };

  var response = await client.Messages.Create(parameters);
  Console.WriteLine(response);
  ```

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

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeSonnet5_5,
  	MaxTokens: 16000,
  	Thinking: anthropic.ThinkingConfigParamUnion{
  		OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{},
  	},
  	OutputConfig: anthropic.OutputConfigParam{
  		Effort: anthropic.OutputConfigEffortHigh, // or Max, Xhigh, Medium, Low
  	},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("...")),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_SONNET_5_5)
      .maxTokens(16000L)
      .thinking(ThinkingConfigAdaptive.builder().build())
      .outputConfig(OutputConfig.builder()
          .effort(OutputConfig.Effort.HIGH) // or MAX, XHIGH, MEDIUM, LOW
          .build())
      .addUserMessage("...")
      .build();

  Message response = client.messages().create(params);
  IO.println(response);
  ```

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

  $message = $client->messages->create(
      maxTokens: 16000,
      messages: [['role' => 'user', 'content' => '...']],
      model: Model::CLAUDE_SONNET_5_5,
      thinking: ['type' => 'adaptive'],
      outputConfig: ['effort' => 'high'], // or 'max', 'xhigh', 'medium', 'low'
  );
  ```

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

  message = client.messages.create(
    model: Anthropic::Model::CLAUDE_SONNET_5_5,
    max_tokens: 16000,
    thinking: {
      type: "adaptive"
    },
    output_config: {
      effort: "high" # or "max", "xhigh", "medium", "low"
    },
    messages: [
      { role: "user", content: "..." }
    ]
  )
  ```
</CodeGroup>

**サンプリングパラメータはエラーを返す。** `temperature`、`top_p`、`top_k`を削除してください。

**思考テキストはデフォルトで省略される。** [応答内の思考を処理する](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-in-responses)を参照してください。

### その他の変更

* **トークン数が約30%増加：** Claude Sonnet 5.5はClaude Sonnet 5のトークナイザーを使用します。Claude Sonnet 4.6、Claude Sonnet 4.5、Claude Haiku 4.5と比較すると、同じテキストでもコンテンツに応じて約30%多くのトークンが生成されます。[トークンカウント](https://platform.claude.com/docs/ja/build-with-claude/token-counting)で再カウントし、`max_tokens`とコストを見直してください。
* **エフォート：** Claude Sonnet 5.5は`xhigh`をサポートしており、レベルが再調整されています。[推奨される変更](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#recommended-changes)を参照してください。
* **画像：** Claude Sonnet 5.5は高解像度の画像ティアを使用し、長辺最大2,576ピクセル、1画像あたり最大4,784ビジュアルトークンに対応します。Claude Sonnet 4.6、Claude Sonnet 4.5、Claude Haiku 4.5は、1,568ピクセルおよび1,568トークンが上限です。2000×1500の画像は、Claude Sonnet 5.5では約2.5倍のトークンを消費します。[解像度とトークンコスト](https://platform.claude.com/docs/ja/build-with-claude/vision#evaluate-image-size)を参照してください。

### Claude Sonnet 4.5以前からの移行

Claude Sonnet 4.5、Claude Sonnet 4、またはClaude 3.7 Sonnetの場合は、まず前述のすべてのセクションを適用してから、以下の変更を行います。

**プレフィルはエラーを返す。** Claude Sonnet 5.5は、Claude Sonnet 4.6およびClaude Sonnet 5と同様に、プレフィルされた最後のアシスタントターンを400エラーで拒否します。Claude Sonnet 4.5、Claude Haiku 4.5、およびそれ以前のモデルはこれを受け付けます。エラーは次のとおりです：

```text wrap
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)を使用するか、分類には列挙型フィールドを持つツールを使用します。
* **前置き：** システムプロンプトで直接的な回答を求めます。
* **不要な拒否：** 通常は、ユーザーメッセージ内の明確な指示で十分です。
* **続き：** ユーザーメッセージに移動します。例：「前回の応答は中断され、`[previous_response]`で終わりました。中断したところから続けてください。」
* **コンテキストのリマインダー：** ユーザーターンに含めます。

**ツール入力のエスケープ。** ツール呼び出しの引数におけるエスケープが異なる場合があります。`input`は標準のJSONパーサーで解析してください。

**コンピューター使用。** Claude Sonnet 5.5は`computer_20250124`を受け付けません。[一部のコンピューター使用ツールバージョンはサポートされていません](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#computer-use-toolset)を参照してください。

**エフォート。** Claude Sonnet 4.5にはエフォートパラメータがありません。エフォートレベルを明示的に設定してください（[推奨される変更](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#recommended-changes)を参照）。

**コンテキストと出力。** Claude Sonnet 5.5は、より大きなコンテキストウィンドウを持ち、出力の上限も高くなっています。[Claude Sonnet 5.5](https://platform.claude.com/docs/ja/models/sonnet-5-5/overview)のモデルページを参照してください。コンテキストウィンドウ関連のベータヘッダーはすべて削除してください。

**ベータヘッダー。** 適応型思考は自動的にインターリーブするため、`interleaved-thinking-2025-05-14`を削除してください。`fine-grained-tool-streaming-2025-05-14`は、必要な各ツールの`eager_input_streaming: true`に置き換えてください。このヘッダーは、コンピューター使用またはブラウザ使用のツールセットエントリと一緒に送信すると400エラーを返します。[きめ細かなツールストリーミング](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/fine-grained-tool-streaming)を参照してください。

**構造化出力。** `output_format`パラメータは非推奨です。それでも使用する場合は、`structured-outputs-2025-11-13`ベータヘッダーを追加してください。これがない場合、APIは400エラーを返します。代わりに`output_config.format`を使用してください。

### Claude Sonnet 4以前からの移行

Claude Sonnet 4はClaude APIでは廃止済みですが、Claude Models on Google Cloud (Google managed)およびAmazon Bedrockでは利用可能です。Claude 3.7 Sonnetは廃止済みです。いずれのモデルからの移行でも、まず前述のすべてのセクションを適用してから、以下の変更を行います：

* **ツールバージョン：** `text_editor_20250728`を、ツール名`str_replace_based_edit_tool`で、`undo_edit`コマンドなしで使用してください。`code_execution_20260521`を使用してください。[テキストエディタツール](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/text-editor-tool)および[コード実行ツール](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/code-execution-tool#upgrade-to-latest-tool-version)を参照してください。
* **停止理由：** `refusal`を処理してください。Claude 4.5以降のモデルは、コンテキストウィンドウの上限に達すると`model_context_window_exceeded`でも停止します。[停止理由とフォールバック](https://platform.claude.com/docs/ja/build-with-claude/handling-stop-reasons)を参照してください。
* **末尾の改行：** Claude 4.5以降のモデルは、ツール呼び出しの文字列パラメータ内の末尾の改行を保持します。
* **ベータヘッダー：** `token-efficient-tools-2025-02-19`および`output-128k-2025-02-19`を削除してください。
* **プロンプト：** [プロンプトのベストプラクティス](https://platform.claude.com/docs/ja/build-with-claude/prompt-engineering/claude-prompting-best-practices)に照らして見直してください。

## Claude Haiku 4.5からClaude Sonnet 5.5への移行

まず、Claude Sonnet 4のサブセクションを除き、[Claude Sonnet 4.5以前からの移行](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#migrating-from-sonnet-45)までのすべてのセクション（同セクションを含む）を適用します。その後、以下の変更を行います：

* **モデルID：** `claude-haiku-4-5-20251001`、またはエイリアス`claude-haiku-4-5`を`claude-sonnet-5-5`に置き換えてください。
* **コスト：** トークンあたりの価格が高くなり、同じテキストでもより多くのトークンが生成されます。トークンを再カウントし、コストのベースラインを再設定してください。[料金](https://platform.claude.com/docs/ja/about-claude/pricing)を参照してください。
* **プロンプトキャッシング：** キャッシュ可能なプロンプトの最小サイズは、4,096トークンから[Claude Sonnet 5.5の最小値](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#other-changes-from-claude-sonnet-5)に引き下げられます。
* **インターリーブ思考：** 適応型思考は、ツール呼び出しの間に自動的に実行されます。
* **ルーティング：** Claude Sonnet 5.5はClaude Haiku 4.5の思考ブロックを読み取ります。上位モデルに移行する会話は推論を保持します。Claude Haiku 4.5に戻る会話では、Claude Sonnet 5.5のブロックが除外されます。
