eca icon indicating copy to clipboard operation
eca copied to clipboard

[BUG]: Anthropic token usage/cost

Open zikajk opened this issue 9 months ago • 2 comments

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.

zikajk avatar Feb 15 '26 11:02 zikajk

Oh so you did the find the reason behind this, is it reallly related to web-search server tool?

ericdallo avatar Feb 15 '26 14:02 ericdallo

@ericdallo I think so. Ask for web search and check tokens, the number is high and doesn't correspond to what I see in chat window.

zikajk avatar Feb 16 '26 07:02 zikajk