1.4 KiB
1.4 KiB
06: AI cost page: tokens, cost, monthly spend, model choice
Part of: ../spec.md
What to build: The AI dashboard gets a cost/ROI page. It shows:
- input, output and thinking tokens and cost per run;
- total spend and this month's spend, with a month-by-month breakdown;
- a coverage pill ("N of M documents priced");
- an "against doing it by hand" panel with editable assumptions, clearly labelled as assumptions.
Cost comes from a pricing table that records its source and its as-of date. Optionally, the skill also adds a model picker for each batch and retry-on-another-model for failed runs.
Blocked by: 05
Status: ready-for-agent
- Cost per call = input tokens × input rate + (output + thinking tokens) × output rate, per million tokens. Long-context rates apply above the threshold.
- An unknown model raises an error that names the known models. Cost never silently defaults to zero.
- A Python self-check covers normal, long-context, thinking-token and unknown-model cases.
- Contract:
RoiRun{model,input_tokens,output_tokens,thinking_tokens,total_cost}and a fetch-ROI action. (Shape from the Superbill prototype.) - The page check asserts that the spend tiles sum the runs, the coverage pill counts priced vs. total documents, and the month breakdown groups runs correctly.
- The model picker and retry-on-other-model are offered as optional sections and built only when chosen.