Sycophant.Pricing.Component (sycophant v0.4.2)

Copy Markdown

A single pricing component from LLMDB's pricing model.

Components have a kind that determines their billing unit:

  • "token" -- per-token rates (input, output, cache, reasoning)
  • "tool" -- per-call rates for built-in tools (web_search, file_search, etc.)
  • "image" -- per-image rates by size/quality
  • "storage" -- per-unit storage rates

Summary

Functions

Converts an LLMDB component map (atom-keyed) into a Component struct.

Reconstructs a Component struct from a serialized map (string-keyed).

Types

t()

@type t() :: %Sycophant.Pricing.Component{
  id: String.t() | nil,
  kind: String.t() | nil,
  meter: String.t() | nil,
  notes: String.t() | nil,
  per: pos_integer() | nil,
  rate: number() | nil,
  size_class: String.t() | nil,
  tool: String.t() | nil,
  unit: String.t() | nil
}

Functions

from_llmdb(map)

@spec from_llmdb(map()) :: t()

Converts an LLMDB component map (atom-keyed) into a Component struct.

from_map(map)

@spec from_map(map()) :: t()

Reconstructs a Component struct from a serialized map (string-keyed).