Skip to content

ModelCosts

Base classes

Name Children Inherits
dict
builtins
dict() -> new empty dictionary

⋔ Inheritance diagram

graph TD
  690778848["toko_types.ModelCosts"]
  2645524081["builtins.dict"]
  2751680898["builtins.object"]
  2645524081 --> 690778848
  2751680898 --> 2645524081

🛈 DocStrings

Bases: TypedDict

Cost information for a model.

Source code in src/tokonomics/toko_types.py
class ModelCosts(TypedDict):
    """Cost information for a model."""

    input_cost_per_token: Decimal
    output_cost_per_token: Decimal
    cache_read_input_token_cost: NotRequired[Decimal]
    """Price of an input token read from the prompt cache."""
    cache_creation_input_token_cost: NotRequired[Decimal]
    """Price of an input token written to the prompt cache."""
    tiers: NotRequired[dict[int, ModelCostTier]]
    """Prompt-size threshold (tokens) -> prices for requests with more input tokens."""

cache_creation_input_token_cost instance-attribute

cache_creation_input_token_cost: NotRequired[Decimal]

Price of an input token written to the prompt cache.

cache_read_input_token_cost instance-attribute

cache_read_input_token_cost: NotRequired[Decimal]

Price of an input token read from the prompt cache.

tiers instance-attribute

tiers: NotRequired[dict[int, ModelCostTier]]

Prompt-size threshold (tokens) -> prices for requests with more input tokens.

:fa-brands-github: Show source on GitHub