← back to AbramsEgo
build-queue/failed/08-provider-donut.md
20 lines
# AbramsEgo build task 08 — per-provider cost donut (panel 3)
SPEC.md panel 3 (Cost & energy P&L) calls for a **per-provider donut**. Today the Cost card renders
a per-model bar list and a 7d trend, but there is no provider-level breakdown/donut. Add one.
1. In `server.js`, extend the cost collector to bucket `~/.claude/cost-ledger.jsonl` (30d) by
**provider** — derive provider from each row's `provider` field if present, else infer from the
`api`/model name (e.g. anthropic/claude→"Anthropic", gpt/openai/codex→"OpenAI", gemini→"Google",
elevenlabs→"ElevenLabs", replicate→"Replicate", exa→"Exa", else "Other"). Expose as
`cost.byProvider` = `[{provider, total}]` sorted desc. Include $0/local providers labeled as such.
2. In `public/index.html`, in the "Cost to run · 30d" card (or the P&L card), render a compact
**pure-SVG/CSS conic-gradient donut** of provider share of 30d spend, with a small legend
(provider · $amount · %). No chart libraries. Match the existing dark theme + CSS var names.
Always show the `$` figure per provider (Steve's "always show costs" rule); free/local → `$0 (local)`.
3. Verify: `pm2 restart abramsego`, then `curl -s -u admin:'DW2024!' http://localhost:9773/api/cost`
shows `byProvider` as a non-empty array, and the donut + legend render.
Commit `feat: per-provider cost donut (SPEC panel 3)`.
Do NOT deploy. Local only.