Class: LlmScraper::LlmClients::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_scraper/llm_clients/base.rb

Direct Known Subclasses

Anthropic, OpenaiCompatible

Constant Summary collapse

PRICING =

Pricing in USD per 1M tokens (updated 2026-06)

{
  "deepseek-v4-flash"        => { input: 0.14, output: 0.28 },
  "deepseek-v4-pro"          => { input: 1.74, output: 3.48 },
  "kimi-k2.5"                => { input: 0.60, output: 3.00 },
  "glm-4.7-flash"            => { input: 0.0,  output: 0.0  },
  "claude-haiku-4-5"         => { input: 0.80, output: 4.00 },
  "claude-haiku-4-5-20251001" => { input: 0.80, output: 4.00 },
  "gemini-2.5-flash"         => { input: 0.15, output: 0.60 },
}.freeze

Instance Method Summary collapse

Instance Method Details

#complete(prompt) ⇒ Hash

Returns { content: String, tokens: { input: Integer, output: Integer }, cost_usd: Float }.

Parameters:

  • prompt (String)

Returns:

  • (Hash)

    { content: String, tokens: { input: Integer, output: Integer }, cost_usd: Float }

Raises:



20
21
22
# File 'lib/llm_scraper/llm_clients/base.rb', line 20

def complete(prompt)
  raise NotImplementedError, "#{self.class}#complete not implemented"
end