chimera.providers.cost_tracker
Two modules cooperate to track LLM spend:
Pricing (chimera.providers.cost)
Section titled “Pricing (chimera.providers.cost)”from chimera.providers.cost import register_model_cost, get_model_costBuilt-in pricing for every model the catalog ships (GLM, Claude, DeepSeek, Kimi, Qwen3, GPT-OSS, …). Register your own:
register_model_cost("acme/llm", 0.50, 1.50) # $/Mtok input, outputReturns input / output USD per million tokens.
Tracker (chimera.providers.cost_tracker)
Section titled “Tracker (chimera.providers.cost_tracker)”from chimera.providers.cost_tracker import CostTrackerCostTracker records granular per-step token counts (cache hits,
reasoning tokens, regular input/output) and rolls them into a session
total.
| Method | Purpose |
|---|---|
record_step(usage) | Append a step’s token usage. |
total_tokens() | Sum across all steps. |
total_cost() | USD across all steps. |
breakdown() | Per-step rows with cache / reasoning / regular splits. |
Wired into the loop via LoopConfig.cost_tracker= and surfaced in the
REPL via /cost.
See also
Section titled “See also”chimera.providersfor the pricing table.chimera.eventsforStepCostEvent.