Module: LlmCostTracker::Pricing::EffectivePrices
- Defined in:
- lib/llm_cost_tracker/pricing/effective_prices.rb
Class Method Summary collapse
Class Method Details
.call(usage:, prices:, pricing_mode:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/llm_cost_tracker/pricing/effective_prices.rb', line 9 def call(usage:, prices:, pricing_mode:) quantities = usage.price_quantities context_tier = context_tier?(usage, prices) Pricing::COMPONENTS.to_h do |component| price_key = component.price_key tokens = quantities.fetch(price_key) price = tokens.positive? ? price_for(prices, price_key, pricing_mode, context_tier) : 0.0 [price_key, price] end end |