fabro/docs/public
Scott Werner 480ff56aba feat(llm): add Response.cost_usd and CostSource across all adapters
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>
2026-05-28 17:05:08 -04:00
..
administration refactor: Remove inbound IP allowlisting (#443) 2026-05-27 22:29:08 -04:00
agents feat(sandbox): secure daytona snapshot names (#429) 2026-05-27 11:52:35 -04:00
api-reference feat(llm): add Response.cost_usd and CostSource across all adapters 2026-05-28 17:05:08 -04:00
changelog docs: document OpenRouter integration 2026-05-28 16:53:34 -04:00
core-concepts docs: document OpenRouter integration 2026-05-28 16:53:34 -04:00
examples feat(sandbox): secure daytona snapshot names (#429) 2026-05-27 11:52:35 -04:00
execution refactor: remove devcontainer support (#433) 2026-05-27 12:48:40 -04:00
getting-started refactor: rationalize server secret scopes (vault-only for optional int… (#401) 2026-05-25 17:26:01 -04:00
human-tools docs: clarify Slack setup and startup logging 2026-05-24 15:29:31 -04:00
images Add system resources settings page (#328) 2026-05-20 17:22:53 -04:00
integrations docs(openrouter): clarify provider_options is API/SDK only 2026-05-28 16:53:34 -04:00
languages refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
logo refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
reference Add fabro variable CLI namespace for server-managed variables (#434) 2026-05-27 13:57:25 -04:00
tutorials docs: sync product docs with runtime changes 2026-05-26 21:55:17 -04:00
workflows Add fabro variable CLI namespace for server-managed variables (#434) 2026-05-27 13:57:25 -04:00
.mintignore refactor(docs): move .mintignore into docs/public and update skill paths 2026-04-27 07:29:59 -07:00
docs.json docs: document OpenRouter integration 2026-05-28 16:53:34 -04:00
dot-highlight.js refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
favicon.svg refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00