API 支持:用法因产品而异。

  • Messages API:在请求中设置 speed: "fast"。
  • Managed Agents:在智能体的模型对象上设置 speed,例如 {"id": "claude-opus-5-5", "speed": "fast"}。

“Fast mode”(快速模式)以溢价定价提供最高 2.5 倍的每秒输出令牌数。在请求中设置 speed: "fast" 即可选择启用。快速模式可在 Claude Opus 5.5 上使用,并在 Claude Opus 5 和 Claude Opus 4.8 上以研究预览形式提供。

快速模式的工作原理

快速模式使用更快的推理配置运行同一模型。智能水平和能力不会发生任何变化。

  • 与标准速度相比,每秒输出令牌数最高可提升 2.5 倍
  • 速度优势集中在 “output tokens per second”(每秒输出令牌数),即 OTPS,而非 “time to first token”(首个令牌生成时间),即 TTFT
  • 与 “streaming”(流式传输)兼容,在流式传输中 OTPS 的提升最为明显

基本用法

快速模式仅适用于受支持的模型。有关详细信息(包括哪些模型需要 beta 标头),请参阅可用性。

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"
    }]
  }'

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

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

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.type === "text");
console.log(textBlock?.text);

C#

AnthropicClient client = new();

var response = await client.Messages.Create(new MessageCreateParams
{
    Model = Model.ClaudeOpus5_5,
    MaxTokens = 4096,
    Speed = Speed.Fast,
    Messages = [
        new UserMessageParam { 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

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

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

$client = new Client();

$response = $client->messages->create(
    model: 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

client = Anthropic::Client.new

response = client.messages.create(
  model: Anthropic::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

速率限制

快速模式具有专用的 “rate limit”(速率限制),与标准 Opus 速率限制相互独立。当超出快速模式速率限制时,API 会返回 429 错误,并附带 retry-after 标头,指示何时会有可用容量。

Claude Opus 5.5 在 Start、Build 和 Scale 使用层级中具有默认的快速模式速率限制,因此您无需申请访问权限即可在该模型上使用快速模式。处于 Evaluation 层级的组织在升级到 Start、Build 或 Scale 层级后,即可在 Claude Opus 5.5 上使用快速模式。

响应中包含指示快速模式速率限制状态的标头:

标头 描述
anthropic-fast-input-tokens-limit 每分钟快速模式输入令牌的最大数量
anthropic-fast-input-tokens-remaining 剩余的快速模式输入令牌数
anthropic-fast-input-tokens-reset 快速模式输入令牌限制的重置时间
anthropic-fast-output-tokens-limit 每分钟快速模式输出令牌的最大数量
anthropic-fast-output-tokens-remaining 剩余的快速模式输出令牌数
anthropic-fast-output-tokens-reset 快速模式输出令牌限制的重置时间

要查看您的快速模式速率限制,请前往 Claude Console 中的速率限制页面。

检查所使用的速度

响应的 usage 对象包含一个 speed 字段,用于指示所使用的速度,值为 "fast" 或 "standard"。在不支持快速模式的模型上请求 speed: "fast" 会返回错误,超出快速模式的速率限制或容量时同样会返回错误(429 或 529)。当带有 speed: "fast" 的请求成功时,usage.speed 为 "fast"。Claude Opus 4.6 是一个例外:带有 speed: "fast" 和 fast-mode-2026-02-01 beta 标头的请求不会返回错误,而是会成功,但以标准速度运行。这一行为会正确反映在 usage.speed 中,此时其显示为 "standard"。在 Claude Models on Google Cloud (Anthropic managed) 上,即使带有该标头,带有 speed: "fast" 的 Claude Opus 4.6 请求也会返回 400 错误。

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"}]
  }'

CLI

ant messages create <<'YAML'
model: claude-opus-5-5
max_tokens: 1024
speed: fast
messages:
  - role: user
    content: Hello
YAML

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

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"

C#

AnthropicClient client = new();

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

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

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

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

$client = new Client();

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

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

Ruby

client = Anthropic::Client.new

response = client.messages.create(
  model: Anthropic::Model::CLAUDE_OPUS_5_5,
  max_tokens: 1024,
  speed: "fast",
  messages: [{ role: "user", content: "Hello" }]
)

puts(response.usage.speed)  # "fast" or "standard"

Output

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

要跟踪整个组织的快速模式使用情况和成本,请参阅用量和成本分析 API。

重试和回退

自动重试

默认情况下,SDK 会自动重试快速模式的 429 错误最多 2 次(可通过 max_retries (typescript, php: maxRetries; java: .maxRetries(); csharp: MaxRetries; go: option.WithMaxRetries()) 进行配置),每次重试前都会等待 retry-after 标头中指定的延迟时间。由于快速模式采用持续的令牌补充机制,retry-after 延迟通常很短,一旦有可用容量,请求即可成功。

回退到标准速度

如果您更希望回退到标准速度而不是等待快速模式容量,请捕获速率限制错误,并在不带 speed: "fast" 的情况下重试。在初始快速请求上将 max_retries (typescript, php: maxRetries; java: .maxRetries(); csharp: MaxRetries; go: option.WithMaxRetries()) 设置为 0,即可跳过自动重试,并在遇到速率限制错误时立即失败。

注意

从快速速度回退到标准速度会导致提示缓存未命中。不同速度的请求不共享缓存前缀。

由于将 max_retries (typescript, php: maxRetries; java: .maxRetries(); csharp: MaxRetries; go: option.WithMaxRetries()) 设置为 0 也会禁用其他瞬态错误(过载、内部服务器错误)的重试,因此以下示例会针对这些情况以默认重试设置重新发出原始请求。

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

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 }
);

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 UserMessageParam { Content = "Hello" }],
        Speed = Speed.Fast,
    },
    maxRetries: 0);

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

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

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

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

注意事项

  • Batch API: 快速模式不适用于 Batch API。
  • Priority Tier: 快速模式不适用于 Priority Tier 承诺。

定价

快速模式在整个 “context window”(上下文窗口)范围内按标准费率的倍数定价,包括输入令牌超过 200k 的请求。

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

快速模式定价可与其他定价调整因素叠加:

有关完整的定价详情,请参阅定价页面。

可用性

快速模式在部分模型上可用或处于研究预览阶段,并具备零数据保留和HIPAA 就绪资格。

API 支持

快速模式仅在以下模型上可用。如果您之前在较早的模型上使用快速模式,请迁移到支持快速模式的模型。

要在 Claude Opus 5 上使用快速模式,请联系您的客户经理或加入候补名单。

警告

Claude Opus 4.8 上的快速模式已弃用,并将于 2026 年 11 月 30 日移除。移除后,向 claude-opus-4-8 发送带有 speed: "fast" 的请求将返回错误。要继续使用快速模式,请迁移到 Claude Opus 5.5。请参阅从 Claude Opus 4.8 迁移到 Claude Opus 5.5。

Messages API

  • 可用性:可用
  • 用法:在请求中设置 speed: "fast"。
状态 云平台 模型
可用 Claude API, Claude Models on Google Cloud (Anthropic managed), Microsoft Foundry (hosted on Azure) Claude Opus 5.5
研究预览 Claude API Claude Opus 5, Claude Opus 4.8

Managed Agents

  • 可用性:可用
  • 用法:在智能体的模型对象上设置 speed,例如 {"id": "claude-opus-5-5", "speed": "fast"}。
状态 云平台 模型
可用 Claude API Claude Opus 5.5
研究预览 Claude API Claude Opus 5, Claude Opus 4.8

所需的 beta 请求头

Beta 请求头概览

Beta 请求头让您可以在实验性功能和新模型能力成为标准 API 的一部分之前访问它们。

请求头 模型
fast-mode-2026-02-01 Claude Opus 5, Claude Opus 4.8

数据处理

数据处理概览

项目 零数据保留 HIPAA
状态 具备资格(不包括 涵盖的模型) 具备资格
详细信息 使用相同的 Messages API 端点,推理速度更快。无论速度设置如何,ZDR 均适用。 —

适用的端点:

  • /v1/messages 使用 speed: "fast"

后续步骤

  • 结构化输出:从智能体工作流中获取经过验证的 JSON 结果。

  • 定价:了解 Anthropic 针对模型和功能的定价结构。

  • Effort:使用 effort 参数控制 Claude 在响应时使用的令牌数量,在响应的详尽程度与令牌效率之间进行权衡。

  • 流式传输消息:使用服务器发送事件以增量方式流式传输 Messages API 响应,包括文本、工具使用和扩展思考的增量内容。