Claude Sonnet 4.5 將於 11 月 30 日退役:5.5 會拒絕 14 種請求中的 8 種
目錄
Claude Sonnet 4.5(claude-sonnet-4-5-20250929)將於 2026 年 11 月 30 日停止支援 Claude API。Sonnet 4.5 常見的 14 種請求形式(請求參數的不同組合)中,有 8 種在官方建議的替代模型 Claude Sonnet 5.5 會回傳 HTTP 400。Anthropic 已於 9 月 30 日將 Sonnet 4.5 標示為棄用。模型進入棄用狀態後仍可回應,但退役日期一到,所有請求都會失敗。Amazon Bedrock 會支援到 2027 年 4 月 8 日,Google Cloud 尚未公布日期。我們透過 Anthropic API,將相同的 14 種請求送至 Sonnet 4.5、Claude Sonnet 4.6 與 Sonnet 5.5,再比較回應格式、權杖數與成本。
TL;DR
- Claude Sonnet 4.5 將於 2026 年 11 月 30 日在 Claude API 退役,Amazon Bedrock 則為 2027 年 4 月 8 日。
- 使用 API 版本
2023-06-01時,Sonnet 5.5 拒絕了 14 種請求中的 8 種;使用2026-10-21時則為 9 種。 - Sonnet 4.6 只拒絕其中 1 種,也就是 assistant prefill,價格則與 Sonnet 4.5 相同。
- 短請求在 Sonnet 5.5 的成本約為每 1,000 次 $1.54,與 Sonnet 4.5 的 $1.47 大致相同,儘管牌價低了 33%。
Claude Sonnet 4.5 何時停止運作?
Sonnet 4.5 將於 2026 年 11 月 30 日停止支援所有由 Anthropic 營運的平台,兩個合作夥伴營運的平台則會更晚。因此,實際退役日期取決於你透過哪個平台呼叫模型。
| 平台 | 2026 年 10 月 26 日的狀態 | 最後服務日期 |
|---|---|---|
| Claude API、AWS 上的 Claude Platform、Google Cloud 上的 Claude Models(由 Anthropic 管理)、Microsoft Foundry | 9 月 30 日起棄用 | 2026 年 11 月 30 日退役 |
Amazon Bedrock(anthropic.claude-sonnet-4-5-20250929-v1:0) | 10 月 8 日起列為 Legacy | 2027 年 4 月 8 日終止服務;2027 年 1 月 8 日起進入「public extended access」,屆時價格可能上漲 |
Google Cloud,由 Google 管理(claude-sonnet-4-5@20250929) | 正式推出 | 尚未宣布棄用;模型頁面的退役日期為「不早於」2026 年 9 月 29 日 |
資料來源:Anthropic 的模型棄用頁面、Bedrock 的模型生命週期(Legacy)頁面,以及 Google Cloud 的 Sonnet 4.5 模型頁面與合作夥伴模型棄用資訊(兩者皆於 10 月 22 日更新)。
Bedrock 的 Legacy 狀態有自己的規則。新客戶無法開始使用這個模型;既有帳戶若連續 15 天沒有呼叫,可能會失去存取權;也不能再購買新的 Provisioned Throughput(保留容量)。模型將於 2027 年 1 月 8 日進入 public extended access,Anthropic 在此期間可能調高價格。
Synthorai 透過 Amazon Bedrock 與 Google Cloud 提供 Sonnet 4.5,因此 11 月 30 日之後,經由 Synthorai 傳送至 claude-sonnet-4-5 的請求仍可運作。Bedrock 本身的終止日期是 2027 年 4 月 8 日。10 月 26 日時,claude-sonnet-4-5 與 claude-sonnet-4-5-20250929 都仍能透過 Synthorai 回應。請利用這段額外時間完成遷移:Bedrock 的價格可能從 1 月 8 日起調整,而且這個模型最終仍會下線。
哪些 Sonnet 4.5 請求在 Sonnet 5.5 會失敗?
Sonnet 4.5 可接受的 14 種請求形式中,有 8 種在 Sonnet 5.5 會失敗,另有 1 種在 Sonnet 4.6 會失敗。我們使用 anthropic-version: 2023-06-01,透過 Anthropic API 對每個模型各傳送一次每種請求。這也是 10 月 21 日主要版本更新前,Anthropic SDK 送出的版本。200 代表請求獲得接受,400 代表遭到拒絕。
| 請求 | Sonnet 4.5 | Sonnet 4.6 | Sonnet 5.5 |
|---|---|---|---|
| 未設定取樣或 thinking 參數 | 200 | 200 | 200 |
temperature: 0 | 200 | 200 | 400 |
temperature: 1.0(預設值) | 200 | 200 | 200 |
top_p: 0.9 | 200 | 200 | 400 |
top_k: 40 | 200 | 200 | 400 |
thinking: {"type": "enabled", "budget_tokens": 2048} | 200 | 200 | 400 |
thinking: {"type": "disabled"} | 200 | 200 | 400 |
tool_choice: {"type": "auto"} | 200 | 200 | 200 |
tool_choice: {"type": "any"} | 200 | 200 | 400 |
tool_choice: {"type": "tool", "name": ...} | 200 | 200 | 400 |
| Assistant prefill(請求以未完成的 assistant 回合結尾) | 200 | 400 | 400 |
stop_sequences | 200 | 200 | 200 |
使用 1 小時 cache_control 的 system prompt | 200 | 200 | 200 |
max_tokens: 64000 | 200 | 200 | 200 |
錯誤訊息會指出應改用什麼:
| 請求 | Sonnet 5.5 的錯誤訊息 |
|---|---|
temperature、top_p、top_k(非預設值) | “`temperature` is deprecated for this model.” |
搭配 budget_tokens 的 thinking | ""thinking.type.enabled” is not supported for this model. Use “thinking.type.adaptive” and “output_config.effort” to control thinking behavior.” |
thinking: disabled | ”To turn thinking off on this model, send “thinking”: {“type”: “between_tools”} instead of {“type”: “disabled”}.” |
強制 tool_choice | ”tool_choice: type “tool” and “any” are not supported for this model.” |
| Assistant prefill | ”This model does not support assistant message prefill. The conversation must end with a user message.” |
新版 SDK 的主要版本會送出 API 版本 2026-10-21。這個版本移除了三個模型的取樣參數,因此在該版本中,Sonnet 4.5 的 temperature 也會失敗。其他項目在兩個版本下都與上表相同。
每種失敗請求該如何修正?
Sonnet 5.5 對每種失敗情況都有替代寫法:
| Sonnet 4.5 請求 | Sonnet 5.5 替代方式 |
|---|---|
temperature、top_p、top_k | 移除這些參數,改用 prompt 引導輸出 |
搭配 budget_tokens 的 thinking | 使用 "thinking": {"type": "adaptive"}(由模型決定思考量),並搭配 "output_config": {"effort": "low"}、"medium" 或 "high"(預設值;effort 控制可使用的思考量) |
thinking: disabled | "thinking": {"type": "between_tools"}(回答前不思考;工具呼叫之間的短註記會以 thinking block 回傳) |
tool_choice: any 或 tool | 使用 tool_choice: auto,並在 prompt 中指定工具名稱;在我們的測試中,所有模型使用 auto 時,10 次請求有 10 次都回傳工具呼叫 |
| Assistant prefill | 以 user message 結尾;若要輸出 JSON,請使用結構化輸出 |
Sonnet 4.5 中設定 thinking budget 的呼叫,在 Sonnet 5.5 應改成:
import anthropic
client = anthropic.Anthropic()
# Sonnet 4.5:
# client.messages.create(model="claude-sonnet-4-5-20250929", max_tokens=4096,
# thinking={"type": "enabled", "budget_tokens": 2048}, messages=messages)
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=4096,
thinking={"type": "adaptive"},
output_config={"effort": "medium"}, # low, medium or high (the default)
messages=[{"role": "user", "content": "Extract the invoice total as JSON."}],
)
哪些變更不會回傳錯誤?
Sonnet 5.5 回應中的第一個 content block 不一定是文字,因此讀取 response.content[0].text 的程式碼,即使收到 200 也可能出錯。Sonnet 5.5 預設會思考(high effort 的 adaptive thinking)。如果回應使用了 thinking,開頭會是 thinking block,除非你要求回傳內容,否則其中的文字為空。我們用 Sonnet 4.5 程式碼原本的方式傳送 20 個擷取 prompt,未設定任何 thinking 參數。Sonnet 5.5 有 11 個回應以 thinking block 開頭。Sonnet 4.5 與 Sonnet 4.6 的 40 個回應則全部以文字開頭。另有 20 個只需回答單一詞彙的分類 prompt,三個模型全都以文字開頭。
不要依位置讀取,應按類型取得 text block:
text = "".join(block.text for block in response.content if block.type == "text")
Thinking 也會計入輸出。在 Sonnet 4.5 不會產生 thinking 內容的擷取呼叫中,Sonnet 5.5 每次呼叫平均使用 69 個 thinking token。這些權杖會記錄在 usage.output_tokens_details.thinking_tokens,並按輸出價格計費。
Sonnet 5.5 比 Sonnet 4.5 便宜嗎?
Sonnet 5.5 的每權杖價格比 Sonnet 4.5 低 33%:每百萬個輸入與輸出權杖分別為 $2 / $10,而非 $3 / $15。不過,相同呼叫的成本大致相同,因為相同文字會計入更多權杖,而且模型預設會思考。每個模型各執行 40 次短版正式環境呼叫(20 次分類、20 次擷取)後,Sonnet 5.5 每 1,000 次呼叫的成本為 $1.54,Sonnet 4.5 則為 $1.47。
| 呼叫 | Sonnet 4.5 每次呼叫成本 | Sonnet 5.5 每次呼叫成本 | 輸入權杖數,4.5 至 5.5 |
|---|---|---|---|
| 分類(單一詞彙標籤),n=20 | $0.00080 | $0.00067 | 240 至 309 |
| 擷取(從電子郵件擷取 JSON 欄位),n=20 | $0.00214 | $0.00241 | 310 至 388 |
| 定義一個工具的單次工具呼叫,n=10 | $0.00253 | $0.00128 | 577 至 391 |
權杖數會隨 tokenizer 改變。Tokenizer 是將文字切分為權杖的元件。Sonnet 5.5 使用 Anthropic 新版模型的 tokenizer,而 Sonnet 4.5 與 Sonnet 4.6 共用較舊的版本。我們使用 Anthropic 免費的 count_tokens endpoint,計算各種 8,000 字元真實文字樣本的權杖數。計算時先扣除內容只有「OK」的訊息權杖數,Sonnet 4.5 為 8 個權杖,Sonnet 5.5 為 10 個,這幾乎都是每則訊息的固定額外負擔:
| 文字(8,000 個字元) | Sonnet 4.5 與 4.6 | Sonnet 5.5 | 變化 |
|---|---|---|---|
| 英文技術部落格文章 | 3,179 | 3,846 | +21% |
| 該文章的德文譯文 | 3,536 | 4,546 | +29% |
| 該文章的中文譯文 | 5,770 | 6,378 | +11% |
| 該文章的日文譯文 | 5,559 | 6,112 | +10% |
| Python 原始碼 | 2,433 | 3,216 | +32% |
| JSON 紀錄 | 2,079 | 2,745 | +32% |
中文與日文文章包含英文術語、數字及 Markdown。若是較短且只含中文或日文的內容,兩個 tokenizer 算出的權杖數相同。若套用 Sonnet 4.5 的價格,Sonnet 5.5 每 1,000 次呼叫的成本會是 $2.31。換句話說,權杖量增加了 57%,而 33% 的降價抵銷了大部分增幅,但仍未完全抵銷。工具呼叫是例外:即使 tokenizer 會產生更多權杖,其輸入仍從 577 降至 391 個權杖,因此 API 加入 prompt 的工具使用指示,在 Sonnet 5.5 上可能更短。對於一個工具搭配短 prompt 的情境,成本降低了一半。
是否應改用 Sonnet 4.6?
Sonnet 4.6 是最省事的遷移選項。它的價格與 Sonnet 4.5 相同,也使用相同的 tokenizer(上述每種文字的權杖數都相同)。在我們測試的 14 種請求中,只有 assistant prefill 失敗。它的退役日期不早於 2027 年 2 月 17 日,可將遷移至 Sonnet 5.5 的時間延後約 11 週。如果 11 月 30 日前來不及重做 thinking budget、強制工具呼叫與回應解析,可先遷移到 Sonnet 4.6,再規劃之後轉移至 Sonnet 5.5。
| Sonnet 4.5 | Sonnet 4.6 | Sonnet 5.5 | |
|---|---|---|---|
| 牌價,每百萬個輸入/輸出權杖 | $3 / $15 | $3 / $15 | $2 / $10 |
| 14 種測試請求中遭拒絕的數量 | 0 | 1 | 8 |
| 相同文字的權杖數 | 基準 | 相同 | 英文 +21%,程式碼與 JSON +32%,中文與日文文章約 +10% |
| 測試中每 1,000 次短呼叫的成本 | $1.47 | $1.47 | $1.54 |
| Claude API 退役日期 | 2026 年 11 月 30 日 | 不早於 2027 年 2 月 17 日 | 不早於 2027 年 9 月 28 日 |
11 月 30 日前應檢查哪些項目?
| 如果程式碼有以下行為 | 檢查項目 | 修改方式 |
|---|---|---|
設定 temperature、top_p 或 top_k | 任何非預設值 | 在 Sonnet 5.5 移除;Sonnet 4.6 使用 2023-06-01 時仍接受這些參數 |
| 設定 thinking budget | thinking.budget_tokens | 改用 adaptive thinking 與 effort level |
| 關閉 thinking | thinking: disabled | 改用 thinking: between_tools |
| 強制使用工具 | tool_choice 的 any 或 tool | 改用 auto,並在 prompt 中指定工具名稱 |
| 預填 assistant 回合 | 以 assistant message 結尾的請求 | 改以 user message 結尾;JSON 使用 structured outputs |
讀取 content[0].text | 回應解析 | 依 type == "text" 篩選 block |
| 依權杖數編列預算 | Prompt 與 context 限制 | 使用 count_tokens 重新計算;測試中英文增加 21%,程式碼增加 32% |
| 在 Amazon Bedrock 執行 | 應查看 Bedrock 日期,而非 Anthropic 日期 | 2027 年 4 月 8 日,價格可能從 1 月 8 日起調整 |
常見問題
Claude Sonnet 4.5 何時退役? Claude Sonnet 4.5 將於 2026 年 11 月 30 日在 Claude API、AWS 上的 Claude Platform、Google Cloud 上由 Anthropic 管理的 Claude Models,以及 Microsoft Foundry 退役。Amazon Bedrock 將於 2027 年 4 月 8 日終止服務。截至 2026 年 10 月 26 日,由 Google 管理的 Google Cloud 尚未公布日期。
哪個模型會取代 Claude Sonnet 4.5?
Anthropic 建議使用 Claude Sonnet 5.5(claude-sonnet-5-5)。Claude Sonnet 4.6 也可作為較短期的替代方案:價格與 Sonnet 4.5 相同,在我們的測試中只拒絕 assistant prefill,並且至少可使用到 2027 年 2 月 17 日。
11 月 30 日後,Sonnet 4.5 的請求會發生什麼事?
傳送至已退役模型的請求會失敗,因此從 11 月 30 日起,在 Claude API 呼叫 claude-sonnet-4-5-20250929 會回傳錯誤。沒有任何平台會自動替你轉移呼叫;你必須自行修改模型名稱與請求形式。
延伸閱讀
- Claude Sonnet 5.5 成本:effort level,以及與 Sonnet 5 相比的每項任務成本
- LLM thinking 控制方式:不同供應商的 adaptive thinking 與 effort 運作方式
- GPT-4 與 GPT-3.5 Turbo 停止服務:OpenAI 端的同類遷移問題
- LLM 結構化輸出:不使用 assistant prefill 產生 JSON 輸出