You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(providers): optional token-usage capture via usage_sink
Add an opt-in `usage_sink` dict to every process_* provider and the shared
call_openai_compatible_api / call_http_api_with_retry core. When supplied it is
populated in place with {prompt_tokens, completion_tokens, total_tokens} (plus a
native USD cost for OpenRouter, which sends usage:{include:true} only when a
sink is passed). Default path is unchanged: omit the sink and the request body,
network behavior, and list[str] return are byte-identical.
Also expose public extractors extract_chat_completions_usage and
extract_gemini_usage. Motivation: recover per-call token usage / cost for
consensus runs without monkeypatching requests.post / generate_content.
- anthropic: bespoke usage normalizer written to the documented Messages-API
shape but NOT validated against the live API (flagged in-code; needs live
tests and confirmation before it is relied on).
- tests: offline behavioral coverage + format-drift resilience (extra/missing/
partial/malformed usage); default-path byte-identical test.
- CHANGELOG: note under Unreleased.
0 commit comments