Module: RubyLLM::Agents::Pricing::RubyLLMAdapter
- Extended by:
- RubyLLMAdapter
- Included in:
- RubyLLMAdapter
- Defined in:
- lib/ruby_llm/agents/pricing/ruby_llm_adapter.rb
Overview
Extracts pricing from the ruby_llm gem’s built-in model registry.
This is a local, zero-HTTP-cost source that provides pricing for models that ruby_llm knows about. It’s the fastest adapter since all data is already loaded in-process.
Uses RubyLLM::Models.find(model_id) which returns pricing as USD per million tokens.
Instance Method Summary collapse
-
#find_model(model_id) ⇒ Hash?
Find and normalize pricing for a model from ruby_llm’s registry.
Instance Method Details
#find_model(model_id) ⇒ Hash?
Find and normalize pricing for a model from ruby_llm’s registry
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ruby_llm/agents/pricing/ruby_llm_adapter.rb', line 26 def find_model(model_id) return nil unless defined?(::RubyLLM::Models) model_info = ::RubyLLM::Models.find(model_id) return nil unless model_info normalize(model_info) rescue nil end |