Module: Brute::UsageDetection
- Defined in:
- lib/brute/usage_detection/usage.rb,
lib/brute/usage_detection/llmrb.rb,
lib/brute/usage_detection/ruby_llm.rb,
lib/brute/usage_detection/lang_chain.rb,
lib/brute/usage_detection/open_router.rb
Overview
What the provider reported, normalised. Every library reports usage differently — OpenRouter as a raw hash on the response, ruby_llm as a Tokens object on the message, llm.rb as an LLM::Usage, langchainrb as per-provider methods digging their own raw shape — so each strategy here reads one of them and answers the same Usage.
Brute::UsageDetection::OpenRouter.detect(response)
# => #<data Brute::UsageDetection::Usage input=10, output=5, total=15, ...>
A strategy reads one response and answers what that provider said — nothing more. It does not derive, sum or accumulate: running totals for a turn are the env's business, not the reader's. A strategy answers nil when the provider reported nothing at all.
Defined Under Namespace
Modules: LLMrb, LangChain, OpenRouter, RubyLLM Classes: Usage