Skip to content

Usage chart cannot show cached-read tokens and overstates cost post-caching-fix #892

Description

@kavin-114

The Settings Billing/Usage chart cannot show prompt-cache savings, and it overstates cost now that caching works (jarvis#861 fix, fleet-agent#229).

What happens: account.py:_direct_llm_usage prices every input token at the model's full input_price_per_1m_usd. Cached reads (roughly 1/10th price on Anthropic, discounted on OpenAI/DeepSeek) are counted as full-price input, and cacheRead/cacheWrite are not stored in the usage rollup at all, so neither the tenant Settings chart nor any admin page can show them. Manual verification currently requires openclaw agent --json in the container or reading session trajectory files.

Expected: the usage rollup carries cached-read (and ideally cache-write) token counts per model, the cost formula prices them at the provider's cached rate, and the Settings usage section shows the cached share so operators can verify caching health from the UI.

Suspected location: jarvis/chat/usage.py (rollup), jarvis/account.py:_direct_llm_usage, frontend/src/charts/usageCharts.js.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions