Was this page helpful?
快速模式為 Claude Opus 4.6 提供顯著更快的輸出 token 生成速度。透過在 API 請求中設定 speed: "fast",您可以以進階定價從同一模型獲得高達 2.5 倍的每秒輸出 token 數。
快速模式目前處於測試版(研究預覽)階段。加入候補名單以申請存取權限。在 Anthropic 收集意見回饋期間,可用性有限。
This feature is eligible for Zero Data Retention (ZDR). When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned.
快速模式支援以下模型:
claude-opus-4-6)快速模式以更快的推理配置運行相同的模型。智能或功能不會有任何變化。
client = anthropic.Anthropic()
response = client.beta.messages.create(
model="claude-opus-4-6",
max_tokens=4096,
speed="fast",
betas=["fast-mode-2026-02-01"],
messages=[
{"role": "user", "content": "Refactor this module to use dependency injection"}
],
)
print(response.content[0].text)快速模式的定價為整個上下文視窗標準 Opus 費率的 6 倍,包括超過 200k 輸入 token 的請求。下表顯示 Claude Opus 4.6 快速模式的定價:
| 輸入 | 輸出 |
|---|---|
| $30 / MTok | $150 / MTok |
快速模式定價與其他定價修飾符疊加:
如需完整定價詳情,請參閱定價頁面。
快速模式有專屬的速率限制,與標準 Opus 速率限制分開。當您的快速模式速率限制超出時,API 會返回帶有 retry-after 標頭的 429 錯誤,指示何時將有可用容量。
回應包含指示您快速模式速率限制狀態的標頭:
| 標頭 | 說明 |
|---|---|
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 限制重置的時間 |
如需特定層級的速率限制,請參閱速率限制頁面。
回應的 usage 物件包含一個 speed 欄位,指示使用了哪種速度,為 "fast" 或 "standard":
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"usage": {
"input_tokens": 523,
"output_tokens": 1842,
"speed": "fast"
}
}若要追蹤整個組織的快速模式使用量和費用,請參閱使用量與費用 API。
當快速模式速率限制超出時,API 會返回帶有 retry-after 標頭的 429 錯誤。Anthropic SDK 預設會自動重試這些請求最多 2 次(可透過 max_retries 設定),在每次重試前等待伺服器指定的延遲時間。由於快速模式使用連續 token 補充,retry-after 延遲通常很短,一旦容量可用,請求就會成功。
如果您希望回退至標準速度而非等待快速模式容量,請捕獲速率限制錯誤並在不使用 speed: "fast" 的情況下重試。在初始快速請求中將 max_retries 設為 0,以跳過自動重試並在速率限制錯誤時立即失敗。
從快速模式回退至標準速度將導致提示快取未命中。不同速度的請求不共享快取前綴。
由於將 max_retries 設為 0 也會停用其他暫時性錯誤(過載、內部伺服器錯誤)的重試,以下範例會針對這些情況以預設重試重新發出原始請求。
speed: "fast" 會返回錯誤。response = client.beta.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
speed="fast",
betas=["fast-mode-2026-02-01"],
messages=[{"role": "user", "content": "Hello"}],
)
print(response.usage.speed) # "fast" or "standard"client = anthropic.Anthropic()
def create_message_with_fast_fallback(max_retries=None, max_attempts=3, **params):
try:
return client.beta.messages.create(**params, max_retries=max_retries)
except anthropic.RateLimitError:
if params.get("speed") == "fast":
del params["speed"]
return create_message_with_fast_fallback(**params)
raise
except (
anthropic.InternalServerError,
anthropic.OverloadedError,
anthropic.APIConnectionError,
):
if max_attempts > 1:
return create_message_with_fast_fallback(
max_attempts=max_attempts - 1, **params
)
raise
message = create_message_with_fast_fallback(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
betas=["fast-mode-2026-02-01"],
speed="fast",
max_retries=0,
)