Skip to content

TokenUsage

Base classes

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

⋔ Inheritance diagram

graph TD
  428434109["toko_types.TokenUsage"]
  2645524081["builtins.dict"]
  2751680898["builtins.object"]
  2645524081 --> 428434109
  2751680898 --> 2645524081

🛈 DocStrings

Bases: TypedDict

Token usage statistics from model responses.

Source code in src/tokonomics/toko_types.py
class TokenUsage(TypedDict):
    """Token usage statistics from model responses."""

    total: int
    """Total tokens used"""
    prompt: int
    """Tokens used in the prompt"""
    completion: int
    """Tokens used in the completion"""

completion instance-attribute

completion: int

Tokens used in the completion

prompt instance-attribute

prompt: int

Tokens used in the prompt

total instance-attribute

total: int

Total tokens used

:fa-brands-github: Show source on GitHub