bug: One-hour Anthropic cache writes are priced at the 5-minute rate, so spend is 37.5% too low
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Read core/parse/inference/anthropic.go around lines 241-276 and the pricing definitions in core/cost/pricing, starting with the Anthropic usage parsing and bundled rates. Add coverage for a mixed 5-minute and 1-hour cache split, then run the relevant Go tests. Done means the 5-minute share retains its current rate and the 1-hour share is priced at 2x the base input rate.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Cortex prices every Anthropic cache write at the 5-minute rate. A 1-hour cache write costs 2x the base input price, but Cortex records 1.25x. So the spend for 1-hour cache writes is 37.5% too low.
Example
claude-sonnet-4-5, cache_creation_input_tokens: 100000, all of them ephemeral_1h_input_tokens:
- Cortex records 100000 × $3.75/MTok = $0.375.
- Anthropic bills 100000 × $6.00/MTok = $0.60.
No unpriced or incomplete marker appears.
Source
Anthropic's prompt-caching docs (https://platform.claude.com/docs/en/build-with-claude/prompt-caching):
- "Cache write tokens with a 5-minute TTL are 1.25 times the base input tokens price."
- "Cache write tokens with a 1-hour TTL are 2 times the base input tokens price."
- The usage object gives the split in
usage.cache_creation.{ephemeral_5m_input_tokens, ephemeral_1h_input_tokens}.cache_creation_input_tokensis their sum.
Cause (main at 676557d35)
core/parse/inference/anthropic.go:241-276reads onlycache_creation_input_tokens.core/cost/pricinghas oneTierCacheWrite.core/cost/pricing/bundled.go:164-166sets it to 1.25x input.- No non-test Go file reads
ephemeral_1h_input_tokens.
Fix
Parse the cache_creation object. Price the 1-hour share at 2x input: either add a tier, or add (1h tokens × 0.75 × input rate) to the cache-write cost. Keep the 5-minute share as it is. Add a test with a mixed split.
Impact if not fixed
Any agent that sends cache_control: {"type": "ephemeral", "ttl": "1h"} sees too little spend. Not measured: how much of real Claude Code traffic uses the 1-hour TTL. The captured fixtures in the repo show ephemeral_1h_input_tokens: 0.
- Ngôn ngữ chính
- Go
- Star
- 26
- Fork
- 46
- Merge trung bình
- 9 giờ 55 phút
- Pull request đã merge (30 ngày)
- 257
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rossoctl/cortex
-
bug laptop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug laptop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
feat: Do not count a removed session's cost again when an import brings it backCó thể đã có người làm @huang195 đã nhận hôm nay. Đang mởenhancement
rossoctl/cortex#1885 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: The JWT bypass matches a cleaned path but forwards the raw path, so /mcp/../healthz skips validationCó thể đã có người làm @evaline-ju đã nhận hôm nay. Đang mởbug
rossoctl/cortex#1884 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug laptop
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rossoctl/cortex
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Containerpak/cpak#93 ·
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
router-for-me/CLIProxyAPI#7607 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement ui/ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
myNameArnav/lex#52 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100