module RubyLLM::Providers::Anthropic::Capabilities

def default_input_price

Returns:
  • (Float) - default price per million tokens for input
def default_input_price
  3.0
end

def default_output_price

Returns:
  • (Float) - default price per million tokens for output
def default_output_price
  15.0
end

def determine_context_window(_model_id)

Returns:
  • (Integer) - the context window size in tokens

Parameters:
  • model_id (String) -- the model identifier
def determine_context_window(_model_id)
  # All Claude 3 and 3.5 and 3.7 models have 200K token context windows
  200_000
end

def determine_max_tokens(model_id)

Returns:
  • (Integer) - the maximum output tokens

Parameters:
  • model_id (String) -- the model identifier
def determine_max_tokens(model_id)
  case model_id
  when /claude-3-7-sonnet/, /claude-3-5/ then 8_192
  else 4_096
  end
end

def get_input_price(model_id)

Returns:
  • (Float) - the price per million tokens for input

Parameters:
  • model_id (String) -- the model identifier
def get_input_price(model_id)
  PRICES.dig(model_family(model_id), :input) || default_input_price
end

def get_output_price(model_id)

Returns:
  • (Float) - the price per million tokens for output

Parameters:
  • model_id (String) -- the model identifier
def get_output_price(model_id)
  PRICES.dig(model_family(model_id), :output) || default_output_price
end

def model_family(model_id)

Returns:
  • (Symbol) - the model family identifier

Parameters:
  • model_id (String) -- the model identifier
def model_family(model_id)
  case model_id
  when /claude-3-7-sonnet/  then :claude37_sonnet
  when /claude-3-5-sonnet/  then :claude35_sonnet
  when /claude-3-5-haiku/   then :claude35_haiku
  when /claude-3-opus/      then :claude3_opus
  when /claude-3-sonnet/    then :claude3_sonnet
  when /claude-3-haiku/     then :claude3_haiku
  else :claude2
  end
end

def model_type(_)

Returns:
  • (String) - the model type, always 'chat' for Anthropic models

Parameters:
  • model_id (String) -- the model identifier (unused but kept for API consistency)
def model_type(_)
  'chat'
end

def supports_extended_thinking?(model_id)

Returns:
  • (Boolean) - true if the model supports extended thinking

Parameters:
  • model_id (String) -- the model identifier
def supports_extended_thinking?(model_id)
  model_id.match?(/claude-3-7-sonnet/)
end

def supports_functions?(model_id)

Returns:
  • (Boolean) - true if the model supports functions

Parameters:
  • model_id (String) -- the model identifier
def supports_functions?(model_id)
  model_id.match?(/claude-3/)
end

def supports_json_mode?(model_id)

Returns:
  • (Boolean) - true if the model supports JSON mode

Parameters:
  • model_id (String) -- the model identifier
def supports_json_mode?(model_id)
  model_id.match?(/claude-3/)
end

def supports_vision?(model_id)

Returns:
  • (Boolean) - true if the model supports vision

Parameters:
  • model_id (String) -- the model identifier
def supports_vision?(model_id)
  # All Claude 3, 3.5, and 3.7 models support vision
  !model_id.match?(/claude-[12]/)
end