---
title: 快速模式
url: https://platform.claude.com/docs/zh-TW/build-with-claude/fast-mode
description: 從支援的 Claude 模型獲得最高 2.5 倍的每秒輸出 token 數。
---

「Fast mode」（快速模式）以進階定價，為 Claude Opus 5.5、Claude Opus 5 和 Claude Opus 4.8 提供最高 2.5 倍的「output tokens per second」（每秒輸出 token 數）。在您的請求中設定 `speed: "fast"` 即可選擇啟用。

<Note>
  Claude Opus 5.5 的快速模式不需要 `fast-mode-2026-02-01` beta 標頭，也不需要申請存取權限。仍傳送該標頭的請求可繼續正常運作。Claude Opus 5 和 Claude Opus 4.8 的快速模式處於研究預覽階段：請聯繫您的客戶經理或[加入候補名單](https://claude.com/fast-mode)以申請存取權限，並在您的請求中傳送 [beta 標頭](https://platform.claude.com/docs/zh-TW/api/beta-headers)。
</Note>

<Note>
  若要了解「zero data retention」（零資料保留），即 ZDR 如何適用於此功能，請參閱 [API 與資料保留](https://platform.claude.com/docs/zh-TW/manage-claude/api-and-data-retention)。
</Note>

## 支援的模型與平台

快速模式支援以下模型與平台：

| 支援的模型                             | 支援的平台                                                                                                                                                                                                                                           |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Claude Opus 5.5 (claude-opus-5-5) | Claude API，包括 [Claude Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/overview)<br />[Claude in Microsoft Foundry](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-in-microsoft-foundry)，適用於託管於 Azure 的部署 |
| Claude Opus 5 (claude-opus-5)     | Claude API，包括 [Claude Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/overview)                                                                                                                                           |
| Claude Opus 4.8 (claude-opus-4-8) | Claude API，包括 [Claude Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/overview)                                                                                                                                           |

如果您先前在較早的模型上使用快速模式，請[遷移至支援快速模式的模型](https://platform.claude.com/docs/zh-TW/models/opus-5-5/migration-guide)。

快速模式不適用於[託管於 Anthropic](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-in-microsoft-foundry#hosting-options)的 Claude in Microsoft Foundry 部署。

## 快速模式的運作方式

快速模式以更快的推論配置執行相同的模型。智慧或能力沒有任何改變。

* 與標準速度相比，每秒輸出 token 數最高提升 2.5 倍
* 速度優勢集中於「output tokens per second」（每秒輸出 token 數），即 OTPS，而非「time to first token」（首個 token 時間），即 TTFT
* 相同的模型權重與行為（並非不同的模型）
* 與 [streaming](https://platform.claude.com/docs/zh-TW/build-with-claude/streaming)（串流）相容，在串流中 OTPS 的提升最為明顯

## 基本用法

處於研究預覽階段的模型也需要 `fast-mode-2026-02-01` [beta 標頭](https://platform.claude.com/docs/zh-TW/api/beta-headers)。

<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-opus-5-5",
      "max_tokens": 4096,
      "speed": "fast",
      "messages": [{
        "role": "user",
        "content": "Refactor this module to use dependency injection"
      }]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 4096
  speed: fast
  messages:
    - role: user
      content: Refactor this module to use dependency injection
  YAML
  ```

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

  response = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=4096,
      speed="fast",
      messages=[
          {"role": "user", "content": "Refactor this module to use dependency injection"}
      ],
  )

  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-opus-5-5",
    max_tokens: 4096,
    speed: "fast",
    messages: [
      {
        role: "user",
        content: "Refactor this module to use dependency injection"
      }
    ]
  });

  const textBlock = response.content.find(
    (block): block is Anthropic.TextBlock => block.type === "text"
  );
  console.log(textBlock?.text);
  ```

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

  var response = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 4096,
      Speed = Speed.Fast,
      Messages = [
          new() { Role = Role.User, Content = "Refactor this module to use dependency injection" }
      ],
  });

  foreach (var block in response.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.ModelClaudeOpus5_5,
  	MaxTokens: 4096,
  	Speed:     anthropic.MessageNewParamsSpeedFast,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Refactor this module to use dependency injection")),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  for _, block := range response.Content {
  	if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
  		fmt.Println(textBlock.Text)
  	}
  }
  ```

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

  Message response = client.messages().create(
          MessageCreateParams.builder()
                  .model(Model.CLAUDE_OPUS_5_5)
                  .maxTokens(4096L)
                  .speed(MessageCreateParams.Speed.FAST)
                  .addUserMessage("Refactor this module to use dependency injection")
                  .build());

  response.content().stream()
          .flatMap(block -> block.text().stream())
          .forEach(textBlock -> IO.println(textBlock.text()));
  ```

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

  $response = $client->messages->create(
      model: 'claude-opus-5-5',
      maxTokens: 4096,
      speed: 'fast',
      messages: [
          ['role' => 'user', 'content' => 'Refactor this module to use dependency injection'],
      ],
  );

  foreach ($response->content as $block) {
      if ($block instanceof \Anthropic\Messages\TextBlock) {
          echo $block->text, PHP_EOL;
      }
  }
  ```

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

  response = client.messages.create(
    model: "claude-opus-5-5",
    max_tokens: 4096,
    speed: "fast",
    messages: [{role: "user", content: "Refactor this module to use dependency injection"}]
  )

  response.content.each do |block|
    puts block.text if block.type == :text
  end
  ```
</CodeGroup>

## 定價

快速模式的定價是在整個 context window（上下文視窗）範圍內以標準費率的倍數計算，包括超過 200k 輸入 token 的請求。下表顯示支援模型的快速模式定價：

| 模型                              | 輸入             | 輸出             |
| ------------------------------- | -------------- | -------------- |
| Claude Opus 5.5                 | $8 USD / MTok  | $40 USD / MTok |
| Claude Opus 5 / Claude Opus 4.8 | $10 USD / MTok | $50 USD / MTok |

快速模式定價可與其他定價調整因子疊加：

* [提示快取倍數](https://platform.claude.com/docs/zh-TW/about-claude/pricing#prompt-caching)會疊加於快速模式定價之上
* [資料駐留](https://platform.claude.com/docs/zh-TW/manage-claude/data-residency)倍數會疊加於快速模式定價之上

如需完整的定價詳情，請參閱[定價](https://platform.claude.com/docs/zh-TW/about-claude/pricing#fast-mode-pricing)頁面。

## 速率限制

快速模式擁有專屬的 rate limit（速率限制），與標準 Opus 速率限制分開。當您的快速模式速率限制被超過時，API 會回傳 `429` 錯誤，並附帶 `retry-after` 標頭，指示何時會有可用容量。

Claude Opus 5.5 在 Start、Build 和 Scale [使用層級](https://platform.claude.com/docs/zh-TW/api/rate-limits)中都有預設的快速模式速率限制，因此您無需申請存取權限，即可在該模型上使用快速模式。處於 Evaluation 層級的組織在升級至 Start、Build 或 Scale 層級後，即可搭配 Claude Opus 5.5 使用快速模式。

回應中包含指示您快速模式速率限制狀態的標頭：

| 標頭                                       | 說明                   |
| ---------------------------------------- | -------------------- |
| `anthropic-fast-input-tokens-limit`      | 每分鐘快速模式輸入 token 的上限  |
| `anthropic-fast-input-tokens-remaining`  | 剩餘的快速模式輸入 token      |
| `anthropic-fast-input-tokens-reset`      | 快速模式輸入 token 限制重設的時間 |
| `anthropic-fast-output-tokens-limit`     | 每分鐘快速模式輸出 token 的上限  |
| `anthropic-fast-output-tokens-remaining` | 剩餘的快速模式輸出 token      |
| `anthropic-fast-output-tokens-reset`     | 快速模式輸出 token 限制重設的時間 |

若要查看您的快速模式速率限制，請前往 Claude Console 中的[速率限制](https://platform.claude.com/usage/limits)頁面。

## 檢查使用了哪種速度

回應的 `usage` 物件包含一個 `speed` 欄位，指示使用了哪種速度，值為 `"fast"` 或 `"standard"`。在[不支援快速模式的模型](https://platform.claude.com/docs/zh-TW/build-with-claude/fast-mode#supported-models-and-platforms)上請求 `speed: "fast"` 會回傳錯誤，超過快速模式的速率限制或容量（`429` 或 `529`）也同樣會回傳錯誤。當帶有 `speed: "fast"` 的請求成功時，`usage.speed` 為 `"fast"`。Claude Opus 4.6 是例外：帶有 `speed: "fast"` 和 `fast-mode-2026-02-01` beta 標頭的請求不會回傳錯誤，而是會成功，但以標準速度執行。此行為會正確反映在 `usage.speed` 中，在這種情況下會顯示 `"standard"`。

<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-opus-5-5",
      "max_tokens": 1024,
      "speed": "fast",
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```

  ```bash CLI
  ant messages create \
    --transform usage.speed \
    --raw-output <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  speed: fast
  messages:
    - role: user
      content: Hello
  YAML
  ```

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

  response = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      speed="fast",
      messages=[{"role": "user", "content": "Hello"}],
  )

  print(response.usage.speed)  # "fast" or "standard"
  ```

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

  const response = await client.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    speed: "fast",
    messages: [{ role: "user", content: "Hello" }]
  });

  console.log(response.usage.speed); // "fast" or "standard"
  ```

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

  var response = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Speed = Speed.Fast,
      Messages = [new() { Role = Role.User, Content = "Hello" }],
  });

  Console.WriteLine(response.Usage.Speed);  // "fast" or "standard"
  ```

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

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Speed:     anthropic.MessageNewParamsSpeedFast,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Hello")),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response.Usage.Speed) // "fast" or "standard"
  ```

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

  MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5_5)
          .maxTokens(1024L)
          .speed(MessageCreateParams.Speed.FAST)
          .addUserMessage("Hello")
          .build();

  Message response = client.messages().create(params);
  IO.println(response.usage().speed().orElseThrow());  // "fast" or "standard"
  ```

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

  $response = $client->messages->create(
      model: 'claude-opus-5-5',
      maxTokens: 1024,
      speed: 'fast',
      messages: [['role' => 'user', 'content' => 'Hello']],
  );

  echo $response->usage->speed;  // "fast" or "standard"
  ```

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

  response = client.messages.create(
    model: "claude-opus-5-5",
    max_tokens: 1024,
    speed: "fast",
    messages: [{ role: "user", content: "Hello" }]
  )

  puts(response.usage.speed)  # "fast" or "standard"
  ```
</CodeGroup>

```json Output
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
// ...
  "usage": {
    "input_tokens": 8,
    "output_tokens": 12,
    "speed": "fast"
  }
}
```

若要追蹤整個組織的快速模式使用量與成本，請參閱[使用量與成本 API](https://platform.claude.com/docs/zh-TW/manage-claude/usage-cost-api)。

## 重試與退回

### 自動重試

當超過快速模式速率限制時，API 會傳回 `429` 錯誤，並附帶 `retry-after` 標頭。SDK 預設會自動重試這些請求最多 2 次（可透過 `max_retries` (typescript, java, php: `maxRetries`; csharp: `MaxRetries`; go: `option.WithMaxRetries`) 設定），並在每次重試前等待伺服器指定的延遲時間。由於快速模式採用持續的 token 補充機制，`retry-after` 延遲通常很短，一旦有可用容量，請求就會成功。

### 退回至標準速度

如果您希望退回標準速度，而不是等待快速模式的容量，請捕捉速率限制錯誤，並在不帶 `speed: "fast"` 的情況下重試。在初始的快速請求上將 `max_retries` (typescript, java, php: `maxRetries`; csharp: `MaxRetries`; go: `option.WithMaxRetries`) 設為 `0`，即可略過自動重試，並在發生速率限制錯誤時立即失敗。

<Note>
  從快速退回至標準速度將導致 [prompt cache](https://platform.claude.com/docs/zh-TW/build-with-claude/prompt-caching)（提示快取）未命中。不同速度的請求不會共用已快取的前綴。
</Note>

由於將 `max_retries` (typescript, java, php: `maxRetries`; csharp: `MaxRetries`; go: `option.WithMaxRetries`) 設為 `0` 也會停用其他暫時性錯誤（過載、內部伺服器錯誤）的重試，以下範例會針對這些情況，以預設重試設定重新發出原始請求。

<CodeGroup exclude="shell:cURL">
  ```bash CLI
  # `ant` 會自動重試 429/5xx，且不提供逐請求的 max_retries
  # 覆寫選項，因此在快速模式下遇到 429 時，備援會在內建
  # 重試用盡後才執行。--transform-error 會顯示 error.type，供分支判斷使用。
  create_message_with_fast_fallback() {
    local speed="$1" max_attempts="${2:-3}" body out
    body=${3:-$(cat)}
    out=$(
      ant messages create \
        ${speed:+--speed "$speed"} \
        --transform-error error.type --format-error yaml <<<"$body" 2>/dev/null
    ) && { printf '%s\n' "$out"; return; }
    case "$out" in
      rate_limit_error)
        if [[ -n "$speed" ]]; then
          create_message_with_fast_fallback "" "$max_attempts" "$body"
          return
        fi ;;
      overloaded_error | api_error | "")
        if (( max_attempts > 1 )); then
          create_message_with_fast_fallback "$speed" $((max_attempts - 1)) "$body"
          return
        fi ;;
    esac
    printf '%s\n' "${out:-connection_error}" >&2
    return 1
  }

  MESSAGE=$(
    create_message_with_fast_fallback fast <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  messages:
    - role: user
      content: Hello
  YAML
  )
  ```

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


  def create_message_with_fast_fallback(max_retries=0, max_attempts=3, **params):
      try:
          return client.with_options(max_retries=max_retries).messages.create(**params)
      except anthropic.RateLimitError:
          if params.get("speed") == "fast":
              del params["speed"]
              return create_message_with_fast_fallback(max_retries=max_retries, **params)
          raise
      except (
          anthropic.APIStatusError,
          anthropic.APIConnectionError,
      ) as error:
          if isinstance(error, anthropic.APIStatusError) and error.status_code < 500:
              raise
          if max_attempts > 1:
              return create_message_with_fast_fallback(
                  max_retries=max_retries, max_attempts=max_attempts - 1, **params
              )
          raise


  message = create_message_with_fast_fallback(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Hello"}],
      speed="fast",
      max_retries=0,
  )
  ```

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

  async function createMessageWithFastFallback(
    params: Anthropic.MessageCreateParamsNonStreaming,
    requestOptions?: Anthropic.RequestOptions,
    maxAttempts: number = 3
  ): Promise<Anthropic.Message> {
    try {
      return await client.messages.create(params, requestOptions);
    } catch (e) {
      if (e instanceof Anthropic.RateLimitError && params.speed === "fast") {
        const { speed, ...rest } = params;
        return createMessageWithFastFallback(rest);
      }
      if (
        e instanceof Anthropic.InternalServerError ||
        e instanceof Anthropic.APIConnectionError
      ) {
        if (maxAttempts > 1) {
          return createMessageWithFastFallback(params, undefined, maxAttempts - 1);
        }
      }
      throw e;
    }
  }

  const message = await createMessageWithFastFallback(
    {
      model: "claude-opus-5-5",
      max_tokens: 1024,
      messages: [{ role: "user", content: "Hello" }],
      speed: "fast"
    },
    { maxRetries: 0 }
  );
  ```

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

  async Task<Message> CreateMessageWithFastFallback(
      MessageCreateParams parameters,
      int? maxRetries = null,
      int maxAttempts = 3)
  {
      try
      {
          var requestClient = maxRetries is int retries
              ? client.WithOptions(options => options with { MaxRetries = retries })
              : client;
          return await requestClient.Messages.Create(parameters);
      }
      catch (AnthropicRateLimitException)
      {
          if (parameters.Speed is not null)
          {
              return await CreateMessageWithFastFallback(
                  parameters with { Speed = null });
          }
          throw;
      }
      catch (Anthropic5xxException)
      {
          if (maxAttempts > 1)
          {
              return await CreateMessageWithFastFallback(
                  parameters, maxAttempts: maxAttempts - 1);
          }
          throw;
      }
  }

  var message = await CreateMessageWithFastFallback(
      new MessageCreateParams
      {
          Model = Model.ClaudeOpus5_5,
          MaxTokens = 1024,
          Messages = [new() { Role = Role.User, Content = "Hello" }],
          Speed = Speed.Fast,
      },
      maxRetries: 0);
  ```

  ```go Go
  func createMessageWithFastFallback(
  	ctx context.Context,
  	client *anthropic.Client,
  	params anthropic.MessageNewParams,
  	maxAttempts int,
  	opts ...option.RequestOption,
  ) (*anthropic.Message, error) {
  	message, err := client.Messages.New(ctx, params, opts...)
  	if err != nil {
  		var apierr *anthropic.Error
  		if errors.As(err, &apierr) && apierr.StatusCode == 429 && params.Speed != "" {
  			params.Speed = ""
  			return createMessageWithFastFallback(ctx, client, params, maxAttempts)
  		}
  		if (errors.As(err, &apierr) && apierr.StatusCode >= 500) || !errors.As(err, &apierr) {
  			if maxAttempts > 1 {
  				return createMessageWithFastFallback(ctx, client, params, maxAttempts-1)
  			}
  		}
  		return nil, err
  	}
  	return message, nil
  }

  func main() {
  	client := anthropic.NewClient()
  	message, err := createMessageWithFastFallback(
  		context.TODO(),
  		&client,
  		anthropic.MessageNewParams{
  			Model:     anthropic.ModelClaudeOpus5_5,
  			MaxTokens: 1024,
  			Messages: []anthropic.MessageParam{
  				anthropic.NewUserMessage(anthropic.NewTextBlock("Hello")),
  			},
  			Speed: anthropic.MessageNewParamsSpeedFast,
  		},
  		3,
  		option.WithMaxRetries(0),
  	)
  	if err != nil {
  		panic(err)
  	}
  	fmt.Println(message)
  }
  ```

  ```java Java
  import com.anthropic.errors.InternalServerException;
  import com.anthropic.errors.RateLimitException;
  // ...
  // 停用 SDK 自動重試，改由下方的備援邏輯處理
  AnthropicClient client =
          AnthropicOkHttpClient.builder().fromEnv().maxRetries(0).build();

  Message createMessageWithFastFallback(
          MessageCreateParams params, int maxAttempts) {
      try {
          return client.messages().create(params);
      } catch (RateLimitException e) {
          if (params.speed().isPresent()) {
              MessageCreateParams retryParams = params.toBuilder()
                      .speed(Optional.empty())
                      .build();
              return createMessageWithFastFallback(retryParams, maxAttempts);
          }
          throw e;
      } catch (InternalServerException e) {
          if (maxAttempts > 1) {
              return createMessageWithFastFallback(params, maxAttempts - 1);
          }
          throw e;
      }
  }

  void main() {
      Message message = createMessageWithFastFallback(
              MessageCreateParams.builder()
                      .model(Model.CLAUDE_OPUS_5_5)
                      .maxTokens(1024L)
                      .addUserMessage("Hello")
                      .speed(MessageCreateParams.Speed.FAST)
                      .build(),
              3);
      message.content().stream()
              .flatMap(block -> block.text().stream())
              .forEach(textBlock -> IO.println(textBlock.text()));
  }
  ```

  ```php PHP
  use Anthropic\Core\Exceptions\APIConnectionException;
  use Anthropic\Core\Exceptions\InternalServerException;
  use Anthropic\Core\Exceptions\RateLimitException;
  use Anthropic\RequestOptions;
  // ...
  $client = new Client();

  function createMessageWithFastFallback(
      Client $client,
      array $params,
      ?RequestOptions $requestOptions = null,
      int $maxAttempts = 3,
  ) {
      try {
          return $client->messages->create(
              ...$params,
              requestOptions: $requestOptions,
          );
      } catch (RateLimitException $e) {
          if (isset($params['speed'])) {
              unset($params['speed']);
              return createMessageWithFastFallback($client, $params);
          }
          throw $e;
      } catch (InternalServerException | APIConnectionException $e) {
          if ($maxAttempts > 1) {
              return createMessageWithFastFallback(
                  $client, $params, maxAttempts: $maxAttempts - 1
              );
          }
          throw $e;
      }
  }

  $message = createMessageWithFastFallback(
      $client,
      [
          'model' => 'claude-opus-5-5',
          'maxTokens' => 1024,
          'messages' => [['role' => 'user', 'content' => 'Hello']],
          'speed' => 'fast',
      ],
      RequestOptions::with(maxRetries: 0),
  );
  ```

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

  def create_message_with_fast_fallback(client, request_options: {}, max_attempts: 3, **params)
    client.messages.create(**params, request_options: request_options)
  rescue Anthropic::Errors::RateLimitError
    raise unless params[:speed] == "fast"
    params.delete(:speed)
    create_message_with_fast_fallback(client, **params)
  rescue Anthropic::Errors::InternalServerError, Anthropic::Errors::APIConnectionError
    raise unless max_attempts > 1
    create_message_with_fast_fallback(client, max_attempts: max_attempts - 1, **params)
  end

  message = create_message_with_fast_fallback(
    client,
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello" }],
    speed: "fast",
    request_options: { max_retries: 0 }
  )
  ```
</CodeGroup>

## 注意事項

* **提示快取：** 在快速與標準速度之間切換會使提示快取失效。不同速度的請求不會共用快取的前綴。
* **TTFT：** 快速模式的優勢集中在每秒輸出 token 數（OTPS），而非首個 token 產生時間（TTFT）。
* **Batch API：** 快速模式不適用於 [Batch API](https://platform.claude.com/docs/zh-TW/build-with-claude/batch-processing)。
* **Priority Tier：** 快速模式不適用於 [Priority Tier](https://platform.claude.com/docs/zh-TW/api/service-tiers) 承諾方案。
* **Claude Platform on AWS：** 快速模式目前不適用於 [Claude Platform on AWS](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-platform-on-aws)。

## 後續步驟

<CardGroup cols={2}>
  <Card title="結構化輸出" icon="code-brackets" href="https://platform.claude.com/docs/zh-TW/build-with-claude/structured-outputs">
    從代理工作流程中取得經過驗證的 JSON 結果。
  </Card>

  <Card title="定價" icon="calculator" href="https://platform.claude.com/docs/zh-TW/about-claude/pricing#fast-mode-pricing">
    了解 Anthropic 針對模型與功能的定價結構。
  </Card>

  <Card title="Effort" icon="gauge" href="https://platform.claude.com/docs/zh-TW/build-with-claude/effort">
    使用 effort 參數控制 Claude 回應時使用的 token 數量，在回應的完整性與 token 效率之間取得平衡。
  </Card>

  <Card title="串流訊息" icon="arrow-right" href="https://platform.claude.com/docs/zh-TW/build-with-claude/streaming">
    透過伺服器傳送事件（server-sent events）以增量方式串流 Messages API 回應，包括文字、工具使用與擴展思考的增量內容。
  </Card>
</CardGroup>
