Class: LlmCostTracker::Dashboard::PricingOverview

Inherits:
Object
  • Object
show all
Defined in:
app/services/llm_cost_tracker/dashboard/pricing_overview.rb

Defined Under Namespace

Classes: Row

Constant Summary collapse

SOURCES =
%i[overrides file bundled].freeze
RATE_COLUMNS =
%w[input output cache_read_input cache_write_input batch_input batch_output].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



15
16
17
# File 'app/services/llm_cost_tracker/dashboard/pricing_overview.rb', line 15

def call
  new.call
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
# File 'app/services/llm_cost_tracker/dashboard/pricing_overview.rb', line 20

def call
  sources = SOURCES.each_with_object({}) do |key, acc|
    source = sources_by_name.fetch(SOURCE_NAME.fetch(key))
    acc[key] = present(key, source) unless source.prices.empty?
  end
  {
    sources: sources,
    effective_source: sources.keys.first || :bundled
  }
end