Problem
Follow-up to #170 / #171. With MiniMax pricing added to the Python pricing.py, the MiniMax cost on the dashboard is still shown as $0 and the LLM Calls StatCard shows 0 even though the "LLM Calls over Time" chart correctly graphs MiniMax points.
Two independent bugs compound:
Bug 1 — bridge plugin never calls compute_cost
plugins/openclaw-agentweave-bridge/src/service.ts:385 does:
const costUsd = e.costUsd ?? 0
turn.span.setAttribute("cost.usd", costUsd)
The bridge takes the cost verbatim from OpenClaw's model.usage event. OpenClaw doesn't know MiniMax pricing and reports costUsd: 0, so the span lands in Tempo with cost.usd=0. The Python proxy's pricing table isn't in the code path at all for these calls.
Verified live on the NAS — e.g. trace 7e82c92b4016da69ba7715097549f71e:
prov.llm.model = MiniMax-M2.7-highspeed
prov.llm.prompt_tokens = 92
prov.llm.completion_tokens = 168
prov.llm.cache_read_tokens = 139257
cost.usd = 0 ← should be ~ $0.005
Bug 2 — dashboard filter excludes agent_turn spans
dashboard/src/lib/queries.ts:49 — tempoSearchQuery filters on span.prov.activity.type = "llm_call". But the openclaw bridge emits openclaw.turn spans with prov.activity.type = "agent_turn", so these are excluded from traceRows. Both the LLM Calls count and Total Cost StatCard derive from traceRows, which is why both show 0 even though the Prometheus-backed chart (which queries traces_spanmetrics_calls_total) shows the calls.
Fix
- Bridge pricing fallback — add a TS pricing table (kept in sync with
sdk/python/agentweave/pricing.py) and a resolveCost(upstream, model, tokens) that prefers a positive upstream value and falls back to the local table when upstream is 0, negative, or NaN. Wire it into the model.usage handler.
- Dashboard filter widen — include
agent_turn spans that have a prov.llm.model attribute alongside llm_call spans.
Acceptance criteria
Problem
Follow-up to #170 / #171. With MiniMax pricing added to the Python
pricing.py, the MiniMax cost on the dashboard is still shown as $0 and the LLM Calls StatCard shows 0 even though the "LLM Calls over Time" chart correctly graphs MiniMax points.Two independent bugs compound:
Bug 1 — bridge plugin never calls
compute_costplugins/openclaw-agentweave-bridge/src/service.ts:385does:The bridge takes the cost verbatim from OpenClaw's
model.usageevent. OpenClaw doesn't know MiniMax pricing and reportscostUsd: 0, so the span lands in Tempo withcost.usd=0. The Python proxy's pricing table isn't in the code path at all for these calls.Verified live on the NAS — e.g. trace
7e82c92b4016da69ba7715097549f71e:Bug 2 — dashboard filter excludes
agent_turnspansdashboard/src/lib/queries.ts:49—tempoSearchQueryfilters onspan.prov.activity.type = "llm_call". But the openclaw bridge emitsopenclaw.turnspans withprov.activity.type = "agent_turn", so these are excluded fromtraceRows. Both the LLM Calls count and Total Cost StatCard derive fromtraceRows, which is why both show 0 even though the Prometheus-backed chart (which queriestraces_spanmetrics_calls_total) shows the calls.Fix
sdk/python/agentweave/pricing.py) and aresolveCost(upstream, model, tokens)that prefers a positive upstream value and falls back to the local table when upstream is 0, negative, or NaN. Wire it into themodel.usagehandler.agent_turnspans that have aprov.llm.modelattribute alongsidellm_callspans.Acceptance criteria
cost.usd > 0in Tempo.llm_callpath (Python proxy → Anthropic/OpenAI/Google) is unaffected.