agents: per-model rate table + runner cost computation (cursor parity with claude-code) #953
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
#967 dashboard: two-meter run header — live context-window % + cumulative $ cost
charles/claude-hooks
#952 agents: live token meter — accumulate per-task usage across both providers
charles/claude-hooks
Reference
charles/claude-hooks#953
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As an operator I want every task to display its accumulated USD cost regardless of provider, so I can compare run cost across models and providers in the dashboard.
Context
Claude Code's
result.total_cost_usdis set by the SDK. Cursor's SDK does not expose USD cost in any message —cursor-sdk-adapter.tshardcodestotalCostUsd: 0. Without computing cost ourselves, every cursor row intask_historyshows €0.00 forever.Acceptance criteria
Rate table
apps/server/src/infrastructure/agent/models-cache.ts(or siblingmodel-rates.ts) with per-model rates:{ provider, modelId, inputPerMTok, outputPerMTok, cacheReadPerMTok, cacheCreationPerMTok }.Agent.listModelsreturns), and any GPT-5/Anthropic Bedrock variants we already use.service-configtable — operator can patch a rate without a redeploy when pricing changes.Runner / event log
usage_delta(and the terminalresult), compute incremental cost from the table and accumulate intorecord.cost_usd. Persist totask_history.cost_usdon terminal.system { subtype: "cost_unknown_model", details: { model } }so the UI can flag the row instead of silently zeroing it.Frontend
$0.043/$1.27.cost_unknown_modelwas raised for the run, show?with a tooltip explaining the missing rate row.Tests
Out of scope
task_history.cost_usdis immutable.References
usage_deltaevent)🤖 Auto-assigned to code-lead (heuristic: area:agents → code-lead (architecture-touching)). Reply
/unassignto reroute.