Skip to content

[BUG]: Anthropic token usage/cost #307

@zikajk

Description

@zikajk

Describe the bug

sessionTokens is treated as context-window usage, but it is derived from provider usage/billing tokens.
With Anthropic web search, usage can include server-side search/tool-use work, so UI can show impossible context values
like278,000 / 200,000while chat still works. This can also cause false context-pressure behavior (for example auto-compact triggers).

To Reproduce

  1. Configure ECA with an Anthropic model that supports web search (for example anthropic/claude-sonnet-4-5).
  2. Start a new chat.
  3. Send a short prompt likely to trigger web search (for example “Find latest X and summarize briefly”).
  4. Wait for the response and check usage in chat.
  5. See sessionTokens jump above limit.context even though responses continue successfully.

Expected behavior
sessionTokens should not be used/displayed as strict context-window occupancy when it includes server-side usage.

Expected options:

  1. Separate “context tokens” vs “billing/usage tokens”.
  2. Do not drive context-threshold/auto-compact from a billing-oriented metric.

Also maybe - Anthropic web-search fixed charges should be reflected in cost reporting; otherwise total cost can be underreported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions