mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:00:47 +00:00
fix: use prompt snapshots for live context diagnostics
This commit is contained in:
@@ -198,6 +198,9 @@ diagnostics + the exporter plugin are enabled.
|
||||
Model usage:
|
||||
|
||||
- `model.usage`: tokens, cost, duration, context, provider/model/channel, session ids.
|
||||
`usage` is provider/turn accounting for cost and telemetry; `context.used`
|
||||
is the current prompt/context snapshot and can be lower than provider
|
||||
`usage.total` when cached input or tool-loop calls are involved.
|
||||
|
||||
Message flow:
|
||||
|
||||
|
||||
@@ -101,6 +101,13 @@ Assistant transcript entries persist the same normalized usage shape, including
|
||||
returns usage metadata. This gives `/usage cost` and transcript-backed session
|
||||
status a stable source even after the live runtime state is gone.
|
||||
|
||||
OpenClaw keeps provider usage accounting separate from the current context
|
||||
snapshot. Provider `usage.total` can include cached input, output, and multiple
|
||||
tool-loop model calls, so it is useful for cost and telemetry but can overstate
|
||||
the live context window. Context displays and diagnostics use the latest prompt
|
||||
snapshot (`promptTokens`, or the last model call when no prompt snapshot is
|
||||
available) for `context.used`.
|
||||
|
||||
## Cost estimation (when shown)
|
||||
|
||||
Costs are estimated from your model pricing config:
|
||||
|
||||
Reference in New Issue
Block a user