Class: ActiveHarness::Pricing::ModelPrice

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_harness/pricing.rb

Overview

Pricing rates for a single model. All *_per_million fields are in USD per 1M tokens. audio_input_per_million / audio_output_per_million may represent per-million audio tokens or per-unit (second/char) depending on provider.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#audio_input_per_millionObject

Returns the value of attribute audio_input_per_million

Returns:

  • (Object)

    the current value of audio_input_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def audio_input_per_million
  @audio_input_per_million
end

#audio_output_per_millionObject

Returns the value of attribute audio_output_per_million

Returns:

  • (Object)

    the current value of audio_output_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def audio_output_per_million
  @audio_output_per_million
end

#cache_read_input_per_millionObject

Returns the value of attribute cache_read_input_per_million

Returns:

  • (Object)

    the current value of cache_read_input_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def cache_read_input_per_million
  @cache_read_input_per_million
end

#cache_write_input_per_millionObject

Returns the value of attribute cache_write_input_per_million

Returns:

  • (Object)

    the current value of cache_write_input_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def cache_write_input_per_million
  @cache_write_input_per_million
end

#context_windowObject

Returns the value of attribute context_window

Returns:

  • (Object)

    the current value of context_window



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def context_window
  @context_window
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def id
  @id
end

#image_input_per_millionObject

Returns the value of attribute image_input_per_million

Returns:

  • (Object)

    the current value of image_input_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def image_input_per_million
  @image_input_per_million
end

#image_output_per_millionObject

Returns the value of attribute image_output_per_million

Returns:

  • (Object)

    the current value of image_output_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def image_output_per_million
  @image_output_per_million
end

#input_modalitiesObject

Returns the value of attribute input_modalities

Returns:

  • (Object)

    the current value of input_modalities



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def input_modalities
  @input_modalities
end

#input_per_millionObject

Returns the value of attribute input_per_million

Returns:

  • (Object)

    the current value of input_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def input_per_million
  @input_per_million
end

#max_output_tokensObject

Returns the value of attribute max_output_tokens

Returns:

  • (Object)

    the current value of max_output_tokens



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def max_output_tokens
  @max_output_tokens
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def name
  @name
end

#output_modalitiesObject

Returns the value of attribute output_modalities

Returns:

  • (Object)

    the current value of output_modalities



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def output_modalities
  @output_modalities
end

#output_per_millionObject

Returns the value of attribute output_per_million

Returns:

  • (Object)

    the current value of output_per_million



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def output_per_million
  @output_per_million
end

#providerObject

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def provider
  @provider
end

#web_search_per_requestObject

Returns the value of attribute web_search_per_request

Returns:

  • (Object)

    the current value of web_search_per_request



20
21
22
# File 'lib/active_harness/pricing.rb', line 20

def web_search_per_request
  @web_search_per_request
end

Instance Method Details

#categoriesObject

Capability tags derived from modality data. Possible values: “vision”, “pdf”, “audio”, “video”, “imggen”, “embed”,

"speech", "transcription", "rerank"


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/active_harness/pricing.rb', line 44

def categories
  inp = Array(input_modalities)
  out = Array(output_modalities)
  cats = []
  cats << "vision"        if inp.include?("image")
  cats << "pdf"           if inp.include?("pdf")
  cats << "audio"         if inp.include?("audio")
  cats << "video"         if inp.include?("video") || out.include?("video")
  cats << "imggen"        if out.include?("image")
  cats << "speech"        if out.include?("speech")
  cats << "transcription" if out.include?("transcription")
  cats << "rerank"        if out.include?("rerank")
  cats << "embed"         if out.include?("embeddings")
  cats
end

#inspectObject



60
61
62
63
64
65
66
67
# File 'lib/active_harness/pricing.rb', line 60

def inspect
  parts = ["id=#{id.inspect}", "provider=#{provider.inspect}"]
  parts << "input=$#{input_per_million}/M"  if input_per_million
  parts << "output=$#{output_per_million}/M" if output_per_million
  parts << "ctx=#{context_window}"           if context_window
  parts << "cats=#{categories.join(',')}"    if categories.any?
  "#<ModelPrice #{parts.join(' ')}>"
end