mirror of
https://github.com/instructkr/claw-code.git
synced 2026-11-18 00:00:00 +08:00
fix(runtime): update model pricing for Anthropic and DeepSeek APIs
* fix(runtime): update model pricing table to current rates Align pricing_for_model with the published Anthropic pricing table: - default_sonnet_tier was $15/$75 (the old Opus rate); it is now the Sonnet 4.x rate of $3/$15, which is what the `sonnet` alias resolves to. - Add Sonnet 5 / 5.5, Haiku 5.5, Haiku 3.5, and Fable / Mythos rates. - Opus 4.5+ is $5/$25 and Opus 5.5 is $4/$20; Opus 4/4.1 keep the $15/$75 tier they are still billed at on Bedrock and Google Cloud. Versions are parsed from the model id so dated, provider-prefixed, and Vertex-style ids resolve to the right tier. Haiku 5.5's >100K-token tier is not modeled because usage is aggregated across requests. * fix(runtime): add DeepSeek API pricing DeepSeek models fell back to default_sonnet_tier ($3/$15 per MTok), overestimating V4 Flash by about 10x on input and 12x on output. Price the ids served by the DeepSeek API at peak rates: deepseek-v4-pro at $1.32/$3.96, and deepseek-flash, deepseek-v4-flash and the retired deepseek-chat / deepseek-reasoner aliases at $0.30/$1.20. Off-peak usage is billed at half. Other DeepSeek models on third-party hosts keep the default because their prices vary by host.
This commit is contained in:
1 parent
78ffd13d19
commit
4b8c79e73c
3 files changed
+151
-33
No files matched your search
@@ -208,7 +208,7 @@ async fn send_message_applies_request_profile_and_records_telemetry() {
|
||||
"\"model\":\"claude-3-7-sonnet-latest\",",
|
||||
"\"stop_reason\":\"end_turn\",",
|
||||
"\"stop_sequence\":null,",
|
||||
"\"usage\":{\"input_tokens\":1,\"cache_creation_input_tokens\":2,\"cache_read_input_tokens\":3,\"output_tokens\":1}",
|
||||
"\"usage\":{\"input_tokens\":100,\"cache_creation_input_tokens\":200,\"cache_read_input_tokens\":300,\"output_tokens\":100}",
|
||||
"}"
|
||||
),
|
||||
&[("request-id", "req_profile_123")],
|
||||
@@ -283,8 +283,8 @@ async fn send_message_applies_request_profile_and_records_telemetry() {
|
||||
if event.namespace == "api"
|
||||
&& event.action == "message_usage"
|
||||
&& event.properties.get("request_id") == Some(&json!("req_profile_123"))
|
||||
&& event.properties.get("total_tokens") == Some(&json!(7))
|
||||
&& event.properties.get("estimated_cost_usd") == Some(&json!("$0.0001"))
|
||||
&& event.properties.get("total_tokens") == Some(&json!(700))
|
||||
&& event.properties.get("estimated_cost_usd") == Some(&json!("$0.0026"))
|
||||
));
|
||||
assert!(matches!(
|
||||
&events[5],
|
||||
|
||||
Reference in new issue
Block a user