Sycophant.Pricing (sycophant v0.4.2)

Copy Markdown

Represents pricing metadata from LLMDB's component-based pricing model.

Attached to Sycophant.Usage as reference data after cost calculation. Contains the currency and all pricing components (tokens, tools, images, storage).

Summary

Functions

Finds a component by ID.

Converts an LLMDB pricing map (atom-keyed) into a Pricing struct.

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

Types

t()

@type t() :: %Sycophant.Pricing{
  components: [Sycophant.Pricing.Component.t()],
  currency: String.t() | nil
}

Functions

find_component(pricing, id)

@spec find_component(t(), String.t()) :: Sycophant.Pricing.Component.t() | nil

Finds a component by ID.

from_llmdb(map)

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

Converts an LLMDB pricing map (atom-keyed) into a Pricing struct.

from_map(map)

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

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