Skip to content

Commit 32a51fb

Browse files
colegottdankclaude
andcommitted
fix(cost): add dated model ID for Claude Sonnet 4.6
PR #5579 added `claude-sonnet-4-6` but the Anthropic API returns the dated version `claude-sonnet-4-6-20260217`. This caused $0 cost calculations since the exact string match failed. Adds the dated model ID to both the legacy cost lookup and unified models mapping. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3dc26c4 commit 32a51fb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/cost/providers/anthropic/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ export const costs: ModelRow[] = [
216216
prompt_cache_creation_1h: 0.000006, // $6 / MTok
217217
},
218218
},
219+
{
220+
model: {
221+
operator: "equals",
222+
value: "claude-sonnet-4-6-20260217",
223+
},
224+
cost: {
225+
prompt_token: 0.000003, // $3 / MTok
226+
completion_token: 0.000015, // $15 / MTok
227+
prompt_cache_write_token: 0.00000375, // 5m cache write: $3.75 / MTok
228+
prompt_cache_read_token: 0.0000003, // Cache hits/refreshes: $0.30 / MTok
229+
prompt_cache_creation_5m: 0.00000375, // $3.75 / MTok
230+
prompt_cache_creation_1h: 0.000006, // $6 / MTok
231+
},
232+
},
219233
{
220234
model: {
221235
operator: "equals",

packages/cost/unified/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ export const modelMapping: CreatorModelMapping = {
336336
provider: "ANTHROPIC",
337337
modelString: "claude-sonnet-4-6",
338338
},
339+
{
340+
provider: "ANTHROPIC",
341+
modelString: "claude-sonnet-4-6-20260217",
342+
},
339343
{
340344
provider: "BEDROCK",
341345
modelString: "anthropic.claude-sonnet-4-6-20260217-v1:0",

0 commit comments

Comments
 (0)