-
Notifications
You must be signed in to change notification settings - Fork 685
Description
Problem:
- I'm using Sonnet 4.6,
- The agent is infact using Sonnet 4.6,
- The usage values are right (token consumption)
- I am being charged for Sonnet 4.6
- But the total_cost_usd aligns with that of Opus 4.6.
How I've verified
I've created a new API key on platform.claude.com, and I've monitored a run for a very simple "hello good morning" message. My system prompt's too large, so that's the reason why the cache_creation_tokens are through the roof.
The usage & cost values:
"value": {
"usage": {
"input_tokens": 3,
"cache_creation_input_tokens": 60710,
"cache_read_input_tokens": 2170,
"output_tokens": 122,
"server_tool_use": {
"web_search_requests": 0,
"web_fetch_requests": 0
},
"service_tier": "standard",
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 60710
},
"inference_geo": "",
"iterations": [],
"speed": "standard"
},
"total_cost_usd": 0.38358749999999997
}
For that usage, here's how the cost looks like for Sonnet 4.6 and Opus 4.6:

As you can see, the Agent SDK's total_cost_usd aligns with Opus 4.6 despite the agent actually using Sonnet 4.6.
What I've tried:
Apart from passing the model as a parameter to the agent, I've also defined it in the settings.json (assuming some CLI setting is messing it all up), but it was all in vain.
How do I get the right cost values from Claude Agent SDK? Is this a bug in the CLI binary / the SDK, or a problem with my configuration?
I'm passing in the model as a parameter to the agent, and the agent is running all fine, but why is the cost value wrong?
Please let me know if you need any more information.

