---
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>

<Tip>
  **Claude APIスキルで移行を自動化しましょう。** Claude Codeで`/claude-api migrate`を実行すると、バンドルされている[Claude APIスキル](https://platform.claude.com/docs/ja/agents-and-tools/agent-skills/claude-api-skill#migrating-to-a-newer-claude-model)が呼び出されます。現行のどのClaudeモデルでも移行先として指定できます。

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

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

  このスキルは、モデルIDの置き換えに加えて、必要に応じて破壊的なパラメータ変更、プリフィルの置き換え、移行先モデルに合わせたeffortの調整をコードベース全体に適用し、その後、手動で確認すべき項目のチェックリストを生成します。ファイルを編集する前に、移行の対象範囲（作業ディレクトリ全体、サブディレクトリ、または特定のファイルリスト）の確認を求めます。また、このスキルはAmazon BedrockおよびClaude Platform on AWSのクライアントを検出し、それらのプラットフォーム向けにモデルIDの形式や機能の変更を調整します。
</Tip>

Claude Sonnet 5.5の料金はClaude Sonnet 5と同じですが、プロンプトキャッシングのキャッシュ読み取りは例外で、100万トークンあたり$0.10 USDと、Claude Sonnet 5の半額です。[Claudeの料金](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」（エフォート）レベルを設定し、SDKのタブではブロックタイプごとに応答を読み取ります。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: 2023-06-01" \
    -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 is Anthropic.TextBlock => block.type === "text"
  );
  console.log(textBlock?.text);
  ```

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

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeSonnet5_5,
      MaxTokens = 4096,
      Messages = [
          new() {
              Role = Role.User,
              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: 'claude-sonnet-5-5',
      outputConfig: ['effort' => 'medium'],
  );

  echo "Stop reason: {$message->stopReason}", PHP_EOL;
  foreach ($message->content as $block) {
      if ($block->type === 'text') {
          echo $block->text, PHP_EOL;
      }
  }
  ```

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

  message = 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"
    }
  )

  puts "Stop reason: #{message.stop_reason}"
  message.content.each do |block|
    puts block.text if block.type == :text
  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: 2023-06-01" \
    -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() { Role = Role.User, 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: 2023-06-01" \
    -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() { Role = Role.User, 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ツールの組み合わせ（Amazon Bedrockでは`auto`のみ）に置き換えます。
* 会話を[追記のみ](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#thinking-blocks)に保ちます。
* Claude APIとGoogle Cloudでは、`fine-grained-tool-streaming-2025-05-14`ベータヘッダーを使わずに、コンピュータ使用を[ツールセット](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#computer-use-toolset)に移行します。
* [アドバイザーツール](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パーサーで解析します。
* Amazon Bedrockでは、コンピュータ使用を`computer_20250124`から[`computer_20251124`](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#computer-use-toolset)に移行します。
* `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`を指定してください。この場合、モデルはツールを呼び出さずに回答できるため、いつツールを使用するかをプロンプトで指示してください。[厳密なツール使用](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)を参照してください。Amazon Bedrockでは、厳密なツール使用を含む[構造化出力](https://platform.claude.com/docs/ja/build-with-claude/structured-outputs)はClaude Sonnet 5.5では利用できません。その場合は、`strict`なしで`auto`を送信し、いつツールを呼び出すかをプロンプトで指示し、コード内でツールの入力を検証してください。

変更前（Claude Sonnet 5）：

<CodeGroup>
  ```bash cURL
  curl 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,
      "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?"}]
    }'
  ```

  ```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() { Role = Role.User, 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: 2023-06-01" \
    -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'\''s 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 tool use（厳格なツール使用）: すべての呼び出しがツールの 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()
          {
              Role = Role.User,
              Content = "What's the weather in Paris? Use the get_weather tool.",
          },
      ],
  });
  ```

  ```go Go
  // strict tool use（厳格なツール使用）: すべての呼び出しがツールの 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 tool use（厳格なツール使用）: すべての呼び出しがツールの 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 tool use（厳格なツール使用）: すべての呼び出しがツールの 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 tool use（厳格なツール使用）: すべての呼び出しがツールの 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、およびそれ以前のモデルの思考ブロックを読み取ります。また、Claude APIおよびGoogle Cloudでは、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)を参照してください。

Claude Sonnet 5.5の各思考ブロックは、それ以前の会話に対しても署名されています。2026年8月31日00:00 UTC以降に作成されたアカウントでは、Claude API、Amazon Bedrock、Google Cloudにおいて、APIがデフォルトでこれを強制します。これらのアカウントでは、以前の履歴を編集した後にブロックを再送するリクエストは400エラーを返します。会話を追記のみに保ち、指示やツールの変更には[会話途中のシステムメッセージ](https://platform.claude.com/docs/ja/build-with-claude/mid-conversation-system-messages)を使用してください。Claude Sonnet 5.5が生成した思考ブロックは、それを生成したアカウント、またはそれにリンクされたアカウントでのみ機能します。[保持された思考](https://platform.claude.com/docs/ja/build-with-claude/preserved-thinking#account-bound-thinking)を参照してください。

### Claude APIとGoogle Cloudでは、コンピュータ使用にツールセットが必要です

Claude APIとGoogle Cloudでは、Claude Sonnet 5.5は`computer_toolset_20260801`ツールセットを通じてのみ「computer use」（コンピュータ使用）をサポートします。これらのプラットフォームでは、`computer_20251124`は400エラーを返します。Claude Sonnet 5.5は、どのプラットフォームでも`computer_20250124`を受け付けません。現在送信しているバージョンを確認してください：

| 現在送信しているバージョン       | それを送信する移行元モデル                                      | Claude APIとGoogle Cloudで送信するもの | Amazon Bedrockで送信するもの |
| ------------------- | -------------------------------------------------- | ------------------------------ | --------------------- |
| `computer_20251124` | Claude Sonnet 5、Claude Sonnet 4.6                  | `computer_toolset_20260801`    | `computer_20251124`   |
| `computer_20250124` | Claude Sonnet 4.5、Claude Haiku 4.5、Claude Sonnet 4 | `computer_toolset_20260801`    | `computer_20251124`   |

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

すでにツールセットを送信しているコードは変更不要です。[`computer_20251124`からの移行](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/computer-use-tool#migrate-from-computer-20251124)に、リクエストとエージェントループの変更点が記載されています。その他のプラットフォームについては、[互換性](https://platform.claude.com/docs/ja/agents-and-tools/tool-use/computer-use-tool#compatibility)を参照してください。

### アドバイザーツールが受け付けるアドバイザーが減りました

[アドバイザーツール](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 Mythos 5、またはClaude Mythos 5.1。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"`：** リクエストが、その他の利用ポリシー領域に該当します。無害な作業でもこのカテゴリがトリガーされることがあります。

[サーバー側フォールバック](https://platform.claude.com/docs/ja/build-with-claude/refusals-and-fallback#server-side-fallback)（`fallbacks: "default"`、ベータ、Claude APIのみ）は、`"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)に申請してください。

### その他の変更点

* **プロンプトキャッシング：** キャッシュ可能なプロンプトの最小サイズは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には、`low`、`medium`、`high`、`xhigh`、`max`の5つのエフォートレベルがあります。Claude APIでのデフォルトは`high`です。レベルは再調整されているため、同じレベルでもClaude Sonnet 5と同じ量の思考が生成されるわけではありません。ワークロードがエージェント型、または「latency」（レイテンシ）に敏感なものでない限り、`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: 2023-06-01" \
    -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() { Role = Role.User, 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: 'claude-sonnet-4-6',
      thinking: ['type' => 'enabled', 'budget_tokens' => 10000],
  );
  ```

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

  message = client.messages.create(
    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: 2023-06-01" \
    -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() { Role = Role.User, 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: '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: "claude-sonnet-5-5",
    max_tokens: 16000,
    thinking: {
      type: "adaptive"
    },
    output_config: {
      effort: "high" # or "max", "xhigh", "medium", "low"
    },
    messages: [
      { role: "user", content: "..." }
    ]
  )
  ```
</CodeGroup>

**サンプリングパラメータはエラーを返します。** Claude Sonnet 4.6以前のモデルとClaude Haiku 4.5は、`temperature`、`top_p`、`top_k`を受け付けます。Claude Sonnet 5.5では、デフォルト以外の値は400エラーを返します。これらを削除してください。

**思考テキストはデフォルトで省略されます。** [レスポンス内の思考を処理する](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`とコストを見直してください。
* **エフォート：** `xhigh`が新たに追加され、レベルが再調整されています。[推奨される変更](https://platform.claude.com/docs/ja/models/sonnet-5-5/migration-guide#recommended-changes)を参照してください。
* **画像：** Claude Sonnet 5.5は高解像度の画像ティアを使用し、長辺最大2576ピクセル、画像あたり最大4,784ビジュアルトークンに対応します。Claude Sonnet 4.6、Claude Sonnet 4.5、Claude Haiku 4.5は1568ピクセルと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)を使用するか、分類にはenumフィールドを持つツールを使用します。Amazon Bedrockでは、Claude Sonnet 5.5で構造化出力は利用できません。その場合は、プロンプトで形式を説明するか`strict`なしのツールを使用し、コード内で出力を検証してください。
* **前置き：** システムプロンプトで直接的な回答を求めます。
* **不要な拒否：** 通常、ユーザーメッセージ内の明確な指示で十分です。
* **続き：** ユーザーメッセージに移動します。例：「Your previous response was interrupted and ended with `[previous_response]`. Continue from where you left off.」
* **コンテキストのリマインダー：** ユーザーターンに含めます。

**ツール入力のエスケープ。** ツール呼び出しの引数のエスケープが異なる場合があります。`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は、ベータヘッダーなしでより大きなコンテキストウィンドウを持ち、出力の上限も高くなっています。[モデルページ](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では廃止済みですが、Amazon BedrockとGoogle Cloudでは引き続き利用できます。Claude 3.7 Sonnetは廃止済みです。いずれのモデルからの移行でも、まずこれより前のすべてのセクションを適用し、次に以下の変更を行います：

* **ツールバージョン：** ツール名`str_replace_based_edit_tool`を使用し、`undo_edit`コマンドのない`text_editor_20250728`を使用します。`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`に置き換えます。
* **コスト：** トークンあたりの価格が高く、同じテキストでもより多くのトークンが生成されます。トークンを再カウントし、コストのベースラインを再設定してください。[Claudeの料金](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のブロックが破棄されます。
