studioglobal
熱門發現
答案已發布9 來源

Claude Opus 4.7 API 收費怎麼算?$5/$25、Token 與快取成本一次看懂

Claude Opus 4.7 在 Anthropic API 的基礎價格為每百萬 input tokens $5、output tokens $25;若使用 prompt caching,cache write 與 cache read 需分開計價。[19] 最穩妥的成本估算流程,是送出前用 /v1/messages/count tokens 計算實際 payload,送出後記錄 response usage,月結再用 Usage & Cost Admin API 對帳。[16][18] Opus 4.7 採用新 tokenizer,同一段文字相較舊模型可能約使用 1x 至 1.35x token;從 Opus 4.6 或更...

18K0
Claude Opus 4.7 API 收費表、token 計算與 prompt caching 成本公式的編輯插圖
Claude Opus 4.7 API 收費指南:$5/$25、Token 計法同成本公式AI-generated editorial illustration for Claude Opus 4.7 API pricing and token accounting.
AI 提示

Create a landscape editorial hero image for this Studio Global article: Claude Opus 4.7 API 收費指南:$5/$25、Token 計法同成本公式. Article summary: Claude Opus 4.7 API 基礎價係每百萬 input tokens $5、每百萬 output tokens $25;但 prompt caching 要另計,而且新 tokenizer 可能令同一段文字用大約 1x 至 1.35x token。[19][20]. Topic tags: ai, anthropic, claude, api pricing, llm. Reference image context from search candidates: Reference image 1: visual subject "# Claude Opus 4.7 上线完全指南(2026 最新):核心升级与国内 API 接入方案. **Claude Opus 4.7 于 2026 年 4 月 16 日正式发布,API model ID 为 `claude-opus-4-7`,定价维持与 Opus 4.6 相同的 $5/M 输入 token、$25/M 输出 token 不变,1M t" source context "Claude Opus 4.7 上线完全指南(2026 最新):核心升级与 ..." Reference image 2: visual subject "# Claude Opus 4.7 上线完全指南(2026 最新):核心升级与国内 API 接入方案. **Claude Opus 4.7 于 2026 年 4 月 16 日正式发布,API model ID 为 `claude-opus-4-7`,定价维持与 Opus 4.6 相同的 $5/M 输入 token、$25/M 输出 token 不变,1M t" source context "Claude Opus 4.

openai.com

Claude Opus 4.7 的標價看起來很直覺:input 每百萬 tokens $5、output 每百萬 tokens $25。但如果你的應用有長 system prompt、工具定義、PDF、圖片,或啟用了 prompt caching,只用「總 token 數 × 單一價格」很容易算錯。

Anthropic 表示,開發者可透過 Claude API 使用 model ID claude-opus-4-7;以下以 Anthropic API pricing 為準。第三方 pricing index 也列出 Claude Opus 4.7 的起始價格為每百萬 input tokens $5、output tokens $25,但若你是透過其他雲端或平台接入,仍應以該平台的實際帳單為準。[7][9][19][21]

價格速覽:每百萬 token 不只一種價格

以下用 MTok 表示 1,000,000 tokens。Anthropic pricing 文件把 Base Input Tokens、Cache Writes、Cache Hits 與 Output Tokens 分開列示,因此實務上也應分項入帳。[19]

收費項目單價怎麼理解
Base input tokens$5 / MTok一般送入模型、未按 cache write 或 cache read 計算的輸入 token。[19]
Output tokens$25 / MTokClaude 生成回覆時產生的輸出 token。[19]
Prompt cache write,5 分鐘 TTL$6.25 / MTok第一次寫入可重用 prompt cache,使用 5 分鐘 TTL 時適用。[19]
Prompt cache write,1 小時 TTL$10 / MTok使用 1 小時 TTL 寫入 prompt cache 時適用。[19]
Cache read / hit$0.50 / MTok命中已快取內容並讀取 cache 時適用。[19]

重點是:不要把所有 token 混成同一包。Opus 4.7 的 input、output、cache write、cache read 單價不同;只要你的產品有使用 prompt caching,成本模型就應該拆開計算。[19]

成本公式:先確認有沒有 prompt caching

沒有 prompt caching

最基本公式是:

成本 = input_tokens ÷ 1,000,000 × 5 + output_tokens ÷ 1,000,000 × 25

例如一次 request 有 200,000 input tokens 與 20,000 output tokens,未計 cache 時就是

$1.00 + $0.50 = $1.50
。這只是依 Anthropic API 的 input/output 單價做算術,不包含其他平台費用或供應商差異。[19]

有 prompt caching

若啟用 prompt caching,應改為逐項相加:

成本 = base_input_tokens ÷ 1,000,000 × 5 + output_tokens ÷ 1,000,000 × 25 + cache_write_5m_tokens ÷ 1,000,000 × 6.25 + cache_write_1h_tokens ÷ 1,000,000 × 10 + cache_read_input_tokens ÷ 1,000,000 × 0.50

如果只使用一種 cache TTL,就只保留對應的 cache write 項目。Anthropic streaming 文件的 usage example 顯示,usage 可包含 input_tokensoutput_tokenscache_creation_input_tokenscache_read_input_tokens 等欄位;pricing 文件也將 cache write 與 cache hit 分開收費。[15][19]

Token 怎麼算最準?送出前用 count_tokens

不要用中文字數、英文字數或大概的 character count 估 API 成本。Anthropic 的 /v1/messages/count_tokens endpoint 是用來在送出 message 前計算 token;文件說明它接受與建立 message 類似的結構化輸入,包括 system prompts、tools、images 與 PDFs,並回傳 total input tokens;所有 active models 都支援 token counting。[18]

最穩妥的流程是:把實際會送進 Messages API 的 payload,原樣送到 count_tokens,包含 system prompt、messages、tools、圖片或 PDF。這樣可以在真正呼叫模型前先估算 input token 成本,也方便在產品內設定預算上限、用量警示或拒絕過大的 request。[18]

送出後:用 response usage 做真實入帳

Request 完成後,應記錄 API response 裡的 usage,不要再用輸出文字長度反推。Anthropic 的 Messages API examples 顯示 response usage 可包含 input_tokensoutput_tokens 等欄位;streaming 文件也顯示 cache 相關欄位,如 cache_creation_input_tokenscache_read_input_tokens[15][17]

如果你使用 streaming,要特別注意 dashboard 或內部報表的加總方式。Anthropic streaming docs 指出,message_delta 裡的 usage token counts 是累積值,不是每個 event 的新增量;若逐個 delta 直接相加,就會把同一批 token 重複計入。[15]

月結與團隊對帳:再用 Usage & Cost Admin API

單次 response log 適合做即時監控,但若要處理團隊月結、workspace 分帳或長期成本分析,應再使用 Anthropic 的 Usage & Cost Admin API。官方文件指出,這個 API 提供 programmatic、granular access to historical API usage and cost data,並可按 model、workspace、service tier 等維度拆分 usage report。[16]

也就是說,app 端可以記錄每次 request 的 usage 來做產品內成本控制;正式對帳與歷史分析,仍應以 Usage & Cost Admin API 的 usage/cost 資料作為基準。[16]

升級到 Opus 4.7 前,要重跑 token budget

Opus 4.7 引入新 tokenizer。Anthropic 文件指出,新 tokenizer 處理文字時,可能使用約 1x 至 1.35x 於 previous models 的 token 數,最高約多 35%,實際幅度會因內容而異;同一段 input 用 /v1/messages/count_tokens 在 Opus 4.7 與 Opus 4.6 會回傳不同 token number。[20]

因此,input $5/MTok、output $25/MTok 不代表升級後帳單一定不變。如果你從 Opus 4.6 或更早模型升級,建議抽樣高流量 prompt、長 context prompt、含 tool definitions 的 payload,以及成本最高的 workflow,重新跑一次 /v1/messages/count_tokens,再更新 alert、rate limit 與成本上限。[18][20]

實務核對清單

  • 確認 API model ID 使用 claude-opus-4-7[9]
  • 重要 release 前,用 /v1/messages/count_tokens 對代表性 payload 做預估。[18]
  • input_tokensoutput_tokens、cache write 與 cache read 分開入帳,不要只存一個 total token 數。[15][19]
  • 使用 streaming 時,記住 message_delta.usage 是累積值,不要逐個 event 重複相加。[15]
  • 團隊月結、workspace 分帳或歷史趨勢分析,使用 Usage & Cost Admin API。[16]
  • 從舊版 Claude model 升級到 Opus 4.7 前,重新測試 tokenizer 對實際 prompt 的影響。[20]

總結來說,Claude Opus 4.7 的 API 基礎價不難記:input $5/MTok、output $25/MTok。真正要算準,關鍵在於送出前用 count_tokens,送出後記錄 usage,並把 prompt caching 與新 tokenizer 的影響納入成本模型。[18][19][20]

Studio Global AI

Search, cite, and publish your own answer

Use this topic as a starting point for a fresh source-backed answer, then compare citations before you share it.

使用 Studio Global AI 搜尋並查核事實

重點

  • Claude Opus 4.7 在 Anthropic API 的基礎價格為每百萬 input tokens $5、output tokens $25;若使用 prompt caching,cache write 與 cache read 需分開計價。[19]
  • 最穩妥的成本估算流程,是送出前用 /v1/messages/count tokens 計算實際 payload,送出後記錄 response usage,月結再用 Usage & Cost Admin API 對帳。[16][18]
  • Opus 4.7 採用新 tokenizer,同一段文字相較舊模型可能約使用 1x 至 1.35x token;從 Opus 4.6 或更早版本升級前,應重新跑 token budget。[20]

人們還問

「Claude Opus 4.7 API 收費怎麼算?$5/$25、Token 與快取成本一次看懂」的簡短答案是什麼?

Claude Opus 4.7 在 Anthropic API 的基礎價格為每百萬 input tokens $5、output tokens $25;若使用 prompt caching,cache write 與 cache read 需分開計價。[19]

首先要驗證的關鍵點是什麼?

Claude Opus 4.7 在 Anthropic API 的基礎價格為每百萬 input tokens $5、output tokens $25;若使用 prompt caching,cache write 與 cache read 需分開計價。[19] 最穩妥的成本估算流程,是送出前用 /v1/messages/count tokens 計算實際 payload,送出後記錄 response usage,月結再用 Usage & Cost Admin API 對帳。[16][18]

接下來在實務上我該做什麼?

Opus 4.7 採用新 tokenizer,同一段文字相較舊模型可能約使用 1x 至 1.35x token;從 Opus 4.6 或更早版本升級前,應重新跑 token budget。[20]

接下來我應該探索哪個相關主題?

繼續“Claude Security 公測版:Anthropic 點樣用 AI 幫企業掃 code 漏洞”以獲得另一個角度和額外的引用。

開啟相關頁面

我應該將其與什麼進行比較?

對照「xAI Grok 4.3 API 解讀:1M context、低 token 價與語音平台野心」交叉檢查此答案。

開啟相關頁面

繼續你的研究

研究對話

研究問題

搜尋及事實查核:Claude Opus 4.7 幾錢?token 點計先最清楚?

Studio Global AI29 來源

引用的答案

如果你講嘅係 Anthropic API,Claude Opus 4.7 官方價目前係每百萬 input tokens 收 $5、每百萬 output tokens 收 $25;如果用 prompt caching,5 分鐘 cache write 係 $6.25/MTok、1 小時 cache write 係 $10/MTok、cache hit/refresh 係 $0.50/MTok。[3] 而且 Opus 4.7 用咗新 tokenizer,官方話同一段固定文字相比舊模型可能會多用最多約 35% tokens,所以「標價冇變」唔代表實際成本一定同舊版一樣。[3][8]

  • 官方 models 頁面列明 Claude Opus 4.7 已經係 generally available,API model ID 係 claude-opus-4-7,定價同上面一致。[2]

  • 最清楚嘅 token 計法,唔好自己估字數,直接用官方 /v1/messages/count_tokens;Anthropic 話呢個 token counting endpoint 接受同 Messages API 一樣嘅結構化輸入,可以喺送出前先計好 input tokens。[9]

  • 送出 request 之後,再睇 API 回傳嘅 usage 欄位;官方文件示例顯示會有 input_tokensoutput_tokens,以及快取相關欄位如 cache_creation_input_tokenscache_read_input_tokens[5]

  • 如果你用 streaming,message_delta 入面見到嘅 usage token counts 係累積值,不是每個 event 單獨新增值。[5]

  • 如果你想對帳最準,官方建議用 Usage & Cost Admin API,因為佢提供歷史 usage 同 cost 資料,並強調可以攞到較精確嘅 token counts,而唔係只靠單次 response 去估。[6]

  • 實際計錢公式,最易記係:

    • 無 cache:
      成本 = (input_tokens / 1,000,000 × $5) + (output_tokens / 1,000,000 × $25)
      [3]
    • 有 cache:再加上 cache_creation_input_tokens 對應 write 價,並把 cache_read_input_tokens 按 $0.50/MTok 去計。[3][5]
  • 例子:如果一次 request 用咗 200,000 input tokens 同 20,000 output tokens,未計 cache 時大約係 $1.00 + $0.50 = $1.50。[3]

  • 要留意,Opus 4.7 新 tokenizer 可能令同一段 prompt 比舊 model 食多 token,所以你如果由 Opus 4.6 轉過去,最好先跑一次 count_tokens 再改 budget。[8][9]

如果你想,我可以下一步直接幫你整一個「Claude Opus 4.7 成本速算表」:輸入 prompt token、output token、cache 有冇開,我即刻幫你計到每次 request 幾錢。

來源

  • [7] Claude Opus 4.7 pricing & specs — Anthropic | CloudPricecloudprice.net

    Claude Opus 4.7. Claude Opus 4.7isAnthropic logoAnthropic's language model with a 1.0M context window and up to 128K output tokens, available from 7 providers, starting at $5.00 / 1M input and $25.00 / 1M output. Canonical ID anthropic-claude-4-7-opus . Ama...

  • [9] Introducing Claude Opus 4.7 - Anthropicanthropic.com

    Skip to main contentSkip to footer. Developers can use claude-opus-4-7 via the Claude API. . . ![Image 5: logo](

  • [15] Streaming Messages - Claude API Docsplatform.claude.com

    event: message startevent: message startdata: {"type":"message start","message":{"id":"msg 01G...","type":"message","role":"assistant","model":"claude-opus-4-6","content":[],"stop reason":null,"stop sequence":null,"usage":{"input tokens":2679,"cache creatio...

  • [16] Usage and Cost API - Claude API Docsplatform.claude.com

    Usage and Cost API. The Usage & Cost Admin API provides programmatic and granular access to historical API usage and cost data for your organization. Leading observability platforms offer ready-to-use integrations for monitoring your Claude API usage and co...

  • [17] Using the Messages API - Claude API Docsplatform.claude.com

    !/bin/sh !/bin/shcurl \ curl \ --header "x-api-key: $ANTHROPIC API KEY" \ --header "x-api-key: $ANTHROPIC API KEY " \ --header "anthropic-version: 2023-06-01" \ --header "anthropic-version: 2023-06-01" \ --header "content-type: application/json" \ --header...

  • [18] Token counting - Claude API Docsplatform.claude.com

    Token counting. Token counting enables you to determine the number of tokens in a message before sending it to Claude, helping you make informed decisions about your prompts and usage. With token counting, you can. How to count message tokens. The token cou...

  • [19] Pricing - Claude API Docsplatform.claude.com

    The "Base Input Tokens" column shows standard input pricing, "Cache Writes" and "Cache Hits" are specific to prompt caching, and "Output Tokens" shows output pricing. Prompt caching multipliers apply on top of fast mode pricing. Fast mode is not available w...

  • [20] What's new in Claude Opus 4.7platform.claude.com

    Claude Opus 4.7 introduces task budgets. This new tokenizer may use roughly 1x to 1.35x as many tokens when processing text compared to previous models (up to 35% more, varying by content), and /v1/messages/count tokens will return a different number of tok...

  • [21] Claude Opus 4.7 API Pricing 2026 - Costs, Performance & Providerspricepertoken.com

    Join the conversation on AI models, pricing, and tools. Price Per TokenPrice Per Token. Claude Opus 4.7 API Pricing 2026. Compare pricing, benchmarks, and providers for Claude Opus 4.7. Pricing starts at $5.00 per million input tokens and $25.00 per million...

Claude Opus 4.7 API 收費怎麼算?$5/$25、Token 與快取成本一次看懂 | 回答 | Studio Global