Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
This repository was archived by the owner on May 15, 2026. It is now read-only.

[BUG] API Cost for OpenRouter Computed Incorrectly #11276

@sawka

Description

@sawka

Problem (one or two sentences)

For the past couple weeks I've been seeing much higher API Cost numbers in Roo. At first I thought it was because of the change to use the tool call APIs. But now I'm convinced it is just a miscalculation of API Cost in Roo itself.

I ran a simple task in Roo, and I also pulled all the data from OpenRouter for that task. Net result is Roo claims $0.36 API Cost, but the sum of the 6 OpenRouter requests sums to ~$0.18 (off by almost a factor of 2x).

I then summed up all the tokens and types in OpenRouter and compared with Roo's totals. The input/output/cached tokens matched exactly.

But, the API Cost was computed as if there was zero caching discount (and also zero extra cost for writing to the cache).

Image Image

Context (who is affected and when)

OpenRouter users.

Reproduction steps

  1. Run a simple task in Roo, and observe the API Cost Total
  2. Look at the corresponding requests and costs in OpenRouter and sum those totals
  3. Compare, and see that they are different

Expected result

The API Cost in Roo matches the API Cost in OpenRouter

Actual result

The API Cost in Roo is much higher than the API Cost in OpenRouter

Variations tried (optional)

No response

App Version

3.47.2

API Provider (optional)

OpenRouter

Model Used (optional)

anthropic/claude-sonnet-4.5

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions