Module: LlmCostTracker::Parsers

Defined in:
lib/llm_cost_tracker/parsers.rb

Defined Under Namespace

Modules: UrlMatchers Classes: Base

Constant Summary collapse

PARSER_PROVIDERS =
%i[Openai Azure OpenaiCompatible Anthropic Gemini].freeze

Class Method Summary collapse

Class Method Details

.find_for(url) ⇒ Object



13
14
15
16
17
18
# File 'lib/llm_cost_tracker/parsers.rb', line 13

def self.find_for(url)
  instances.each do |klass, instance|
    return instance if klass.match?(url)
  end
  nil
end

.find_for_provider(provider) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/llm_cost_tracker/parsers.rb', line 20

def self.find_for_provider(provider)
  provider_name = provider.to_s.downcase
  instances.each do |klass, instance|
    return instance if klass.provider_names.include?(provider_name)
  end
  nil
end