#claude-sonnet-4 random high price after 1M model

3 messages · Page 1 of 1 (latest)

autumn vortexBOT
#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help debug your issue with unexpected high pricing for claude-sonnet-4 after the 1M token context deployment, I need a bit more information:

  1. Can you provide the exact error message or response you see when the high charge occurs?
  2. Are you consistently using the exact same model identifier (please paste the full model name, e.g., anthropic/claude-3-sonnet-20240229 or similar)?
  3. Can you share the relevant part of your API call or code, including the parameters for max_tokens, input/output tokens, etc.?

These details will help identify if it's a model, provider, or usage calculation issue.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.

OpenRouter

A router for LLMs and other AI models

upper prism
#

request 1
{
"id": 18332727487,
"model": "anthropic/claude-4-sonnet-20250522",
"created_at": "2025-08-14T23:54:11.848393+00:00",
"tokens_prompt": 284578,
"tokens_completion": 671,
"native_tokens_prompt": 364581,
"native_tokens_completion": 747,
"native_tokens_reasoning": 156,
"origin": "https://cline.bot/",
"usage": 0.2627424,
"api_type": "completions",
}
vs immediate next request
{
"id": 18333049801,
"provider_name": "Anthropic",
"model": "anthropic/claude-4-sonnet-20250522",
"created_at": "2025-08-15T00:00:24.168544+00:00",
"tokens_prompt": 288146,
"tokens_completion": 630,
"native_tokens_prompt": 368582,
"native_tokens_completion": 692,
"native_tokens_reasoning": 336,
"usage": 2.7799215,
}

autumn vortexBOT
#

Thanks for sharing the detailed usage stats. To analyze why the second request was charged 10x more despite nearly identical prompt and completion token counts, here’s what you should check:

  1. Usage Calculation Is Token-Based:
    The OpenRouter API charges are based on the number of prompt and completion tokens, as shown in the usage breakdown in your API response. The cost field should reflect this:

“The usage response includes detailed cost information:

  1. Possible Causes for High Charges:

    • Different Providers/Routing: Sometimes, the same model identifier could be routed to different providers or infrastructure, which might have different pricing.
    • Native Token Calculation: Notice the difference between tokens_prompt and native_tokens_prompt. Pricing is generally based on native tokens. In both requests, these are close, so this shouldn't explain a 10x jump unless provider pricing tiers changed between requests.
    • Temporary Pricing Changes or Bugs: If you are seeing “random” high prices, there could be a temporary pricing or accounting bug, especially after a major deployment (like the 1M token context update).
  2. Action Steps:

    • Double-check the exact cost per token for this model at OpenRouter Models for anthropic/claude-4-sonnet-20250522.
    • Compare the full usage objects in your responses for any new or changed fields.
    • If the above factors don’t explain the pricing, this could be an internal accounting bug or backend issue.

Recommendation: For billing anomalies that can’t be explained by token differences or published pricing, please conta...

OpenRouter

Browse models on OpenRouter