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
fix(cost): make cost telemetry survive non-Anthropic models
llm-cost-by-model and llm-cost-total returned empty against a fully
analyzed db with 358 analyze txes. Three compounding bugs:
1. model-pricing keyed by date-stamped ids
Provider responses now carry undated model names ("claude-sonnet-4-6"
from the LevelInfinite/Tencent gateway, "glm-4.6" from Z.ai). The
pricing table only had "claude-sonnet-4-6-20250514" etc., so lookup
missed every response and estimate-cost returned 0.0. Switched to
prefix-match against undated keys so both bare and date-stamped
ids hit. Also added claude-opus-4-7.
2. :tx/cost-usd asserted only when (pos? cost)
With cost=0 for GLM-quota and now-misnamed Claude responses, the
attribute was never written. Drop the guard — write 0.0 explicitly
so the schema is uniform across txes.
3. cost queries used bare datalog clauses
[?tx :tx/cost-usd ?cost] silently excludes any tx without the attr,
which (after the bugs above) was every tx. Switch to get-else with
0.0 default. llm-cost-total also gains a :tx/op anchor (analyze or
synthesize) so it doesn't pull in import/enrich/seed rows that
never had token attributes.
Probed both providers directly: neither GLM nor Tencent return cost
in usage — they relay Anthropic-format JSON unchanged. The fix is
local pricing and local query hygiene, nothing provider-side.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments