You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 599e036
Browse filesBrowse the repository at this point in the historyBrowse files
Preparation for pointing cxagent at OpenRouter. The wiring already exists —
it is a first-class preset with base URL, attribution header, Bearer auth and
cached_tokens parsing — so a smoke run needs no new code. This is the one
number that would have been wrong.
A HIT IS NOT ALWAYS FREE. On a local llama.cpp, filling the cache costs
nothing: it is the server's own RAM, and it reports no writes at all. Through
OpenRouter it is billed — OpenAI charges 1.25x normal input to write,
Anthropic 1.25x for a five-minute entry and 2x for an hour. So a session can
show a healthy hit rate while the warming cost more than the reads saved, and
the two cases are indistinguishable from the hit rate alone.
Reporting hits without writes is worse than reporting neither, because the
number looks trustworthy. opencode carries this exact bug open
(anomalyco/opencode#18440): cache write tokens unaccounted, costs understated.
prompt_tokens_details.cache_write_tokens now flows through LlmUsage, the
ledger, the panel and /stats, with a schema migration for history. A write
with no read still counts as REPORTED: the first turn against a paid provider
warms the cache and hits nothing, which is a real measurement of an expensive
turn rather than a silent provider.
Both readouts stay a single clean figure where writes are zero, so nothing
changes on a local endpoint — verified: 47 history rows migrated intact,
writes 0 throughout.
0 commit comments