Published: 2026-12-06 · Featured Model: claude-sonnet-5
TL;DR: 12 月核价时,Sonnet 5 命中的输入片段省 90%。用十轮会话比较首次写入、变化的输入和全价输出。
拆开四项计费
12 月 6 日核对 claude-sonnet-5,读取单价为普通输入的十分之一。唯一一笔正额消费记录含 14 个提示词 token、3 个输出 token,记录的缓存读取为零。样本证实有调用,未观察到命中,折扣来自费率对比。
前四行单独按百万 token 换算,方便核账。后三行模拟十次独立请求,每轮固定前缀 20,000 token,新增输入 1,000、输出 500。忽略历史增长,按目录中的短期写入档计价。前缀每轮只归入一个档位。
$10 能买多少
各行独立使用美元余额。读取本站当前零售价,视频按秒、图像按张、文本按百万 token。总价取到微美元,份数向下取整。目录未加载、缺档或停售显示 —。不含额外重做、充值税费和编辑器费用。
| 计数单位 | 规格 × 数量 × 单价 | 每份 | $10 整份数 | 余额 |
|---|---|---|---|---|
| 百万 token | claude-sonnet-5 input × 1 × $0.7 | $0.7 | 14 | $0.2 |
| 百万 token | claude-sonnet-5 cachedInput × 1 × $0.07 | $0.07 | 142 | $0.06 |
| 百万 token | claude-sonnet-5 cacheWrite × 1 × $0.875 | $0.875 | 11 | $0.375 |
| 百万 token | claude-sonnet-5 output × 1 × $3.5 | $3.5 | 2 | $3 |
| 10 轮无缓存 | claude-sonnet-5 input × 0.2 × $0.7 claude-sonnet-5 input × 0.01 × $0.7 claude-sonnet-5 output × 0.005 × $3.5 | $0.1645 | 60 | $0.13 |
| 1 写 + 9 读 | claude-sonnet-5 cacheWrite × 0.02 × $0.875 claude-sonnet-5 cachedInput × 0.18 × $0.07 claude-sonnet-5 input × 0.01 × $0.7 claude-sonnet-5 output × 0.005 × $3.5 | $0.0546 | 183 | $0.0082 |
| 10 次重写 | claude-sonnet-5 cacheWrite × 0.2 × $0.875 claude-sonnet-5 input × 0.01 × $0.7 claude-sonnet-5 output × 0.005 × $3.5 | $0.1995 | 50 | $0.025 |
整段会话省多少
当前命中片段省 90.0%,上表一次写入九次命中的会话省 66.8%。前缀经常变动时,每次都可能付写入溢价。先把工具定义和仓库规范放在前面,把时间戳、问题和变更放在后面。
让 Claude Code 走 Messages 协议
在新 Bash 终端使用限额密钥。客户端会在域名后追加 /v1/messages。开始前用 /status 核对连接和模型 ID。发送的上下文会经过网关,先检查仓库权限并移除机密。
export ANTHROPIC_BASE_URL=https://cliprelayai.com
export ANTHROPIC_AUTH_TOKEN="$CLIPRELAY_API_KEY"
claude --model claude-sonnet-5用两次付费请求验证命中
示例用合成前缀,避免上传源文件。连续执行两次,查看 usage 的 cache_creation_input_tokens 和 cache_read_input_tokens,再与请求记录核账。缺字段或读取为零都不能证明省钱。放量前核对前缀长度、字节一致性、过期时间和路由。
set -eu
for i in 1 2; do
python3 -c 'import json,sys
rules = "\n".join(f"Item {n} requires review by the editor." for n in range(800))
print(json.dumps(dict(model="claude-sonnet-5", max_tokens=32,
system=[dict(type="text",text=rules,cache_control=dict(type="ephemeral"))],
messages=[dict(role="user",content="Who reviews item "+sys.argv[1]+"?")])))' "$i" |
curl -fsS https://cliprelayai.com/v1/messages \
-H "x-api-key: $CLIPRELAY_API_KEY" -H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" --data-binary @- |
python3 -c 'import json,sys; print(json.load(sys.stdin)["usage"])'
done扣费前复核报价
2026 年 12 月 6 日核查了公开定价接口和远程 MCP 目录。先用 Python 3 重算线上报价,再用下方 Bash 请求核对 MCP 的模型 ID。查询不会生成素材。鉴权请求需要在终端设置 CLIPRELAY_API_KEY。
# python3
import json, urllib.request
from decimal import Decimal as D, ROUND_HALF_UP
req = urllib.request.Request("https://cliprelayai.com/v1/cliprelay-pricing", headers={"User-Agent": "ClipRelay-budget/1.0"})
with urllib.request.urlopen(req, timeout=30) as f:
models = json.load(f, parse_float=D)["data"]["models"]
rows = [
[["claude-sonnet-5","input",1]],
[["claude-sonnet-5","cachedInput",1]],
[["claude-sonnet-5","cacheWrite",1]],
[["claude-sonnet-5","output",1]],
[["claude-sonnet-5","input",0.2],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
[["claude-sonnet-5","cacheWrite",0.02],["claude-sonnet-5","cachedInput",0.18],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
[["claude-sonnet-5","cacheWrite",0.2],["claude-sonnet-5","input",0.01],["claude-sonnet-5","output",0.005]],
]
for parts in rows:
total = D(0)
for model, tier, qty in parts:
m = models[model]
price = D(str(m["retail"][tier]))
if not m.get("enabled", True) or price <= 0:
raise ValueError(model)
total += price * D(str(qty))
total = total.quantize(D(".000001"), rounding=ROUND_HALF_UP)
print(parts, total, int(10 // total), 10 % total)curl -fsS https://cliprelayai.com/mcp \
-H "Authorization: Bearer $CLIPRELAY_API_KEY" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_models",
"arguments": {
"type": "text"
}
}
}'