mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-29 01:42:21 +00:00
Adds two new fields to the unified completion Response: - cost_usd: Option<f64> — USD cost for the completion - cost_source: Option<CostSource> — Authoritative | Estimated A new fabro_llm::cost::estimate_cost_usd helper centralizes the catalog math (tokens × catalog price → USD micros → f64). Every adapter response path (Anthropic, OpenAI, Gemini, openai_chat) calls the helper when a catalog is available, producing Estimated costs. Adapters with authoritative provider-side pricing (e.g. OpenRouter, in a later commit) will bypass the helper and set Authoritative. The openai_chat streaming path now plumbs catalog + speed through StreamState so finish_events can call the helper before assembling the final Response. Public API surface: CompletionResponse in fabro-api.yaml is extended with cost_usd and cost_source. Progenitor + the TS client are regenerated; apps/fabro-web typechecks clean since both fields are optional. 42 Response constructor sites updated: - 5 live adapter sites call estimate_cost_usd - ~32 synthesized/fallback/test sites set (None, None) explicitly - 5 test fixtures in types.rs set (None, None) 397 lib tests pass (was 392, +5 new helper unit tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| administration | ||
| agents | ||
| api-reference | ||
| changelog | ||
| core-concepts | ||
| examples | ||
| execution | ||
| getting-started | ||
| human-tools | ||
| images | ||
| integrations | ||
| languages | ||
| logo | ||
| reference | ||
| tutorials | ||
| workflows | ||
| .mintignore | ||
| docs.json | ||
| dot-highlight.js | ||
| favicon.svg | ||