Module: RubyLLM::Agents::Pricing::OpenRouterAdapter
- Extended by:
- OpenRouterAdapter
- Included in:
- OpenRouterAdapter
- Defined in:
- lib/ruby_llm/agents/pricing/openrouter_adapter.rb
Overview
Normalizes OpenRouter bulk model list into the common pricing format.
OpenRouter prices are strings representing USD per token. This adapter converts them to Float.
Coverage: 400+ text LLM models, some audio-capable chat models. No transcription, image generation, or embedding models.
Instance Method Summary collapse
-
#find_model(model_id) ⇒ Hash?
Find and normalize pricing for a model.
Instance Method Details
#find_model(model_id) ⇒ Hash?
Find and normalize pricing for a model
25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby_llm/agents/pricing/openrouter_adapter.rb', line 25 def find_model(model_id) models = DataStore.openrouter_data return nil unless models.is_a?(Array) && models.any? entry = find_by_id(models, model_id) return nil unless entry normalize(entry) end |