Skip to content

Usage

Base classes

Name Children Inherits
AnnotatedObject
aclientp.schema.base
Base class for generated models.

⋔ Inheritance diagram

graph TD
  95970848364176["session_updates.Usage"]
  95970862258240["base.AnnotatedObject"]
  95970862254416["base.Schema"]
  95970851503232["main.BaseModel"]
  125067848591872["builtins.object"]
  95970862258240 --> 95970848364176
  95970862254416 --> 95970862258240
  95970851503232 --> 95970862254416
  125067848591872 --> 95970851503232

🛈 DocStrings

Bases: AnnotatedObject

UNSTABLE: Token usage information for a prompt turn.

Source code in src/aclientp/schema/session_updates.py
class Usage(AnnotatedObject):
    """**UNSTABLE**: Token usage information for a prompt turn."""

    total_tokens: int = Field(ge=0)
    """Sum of all token types across session."""

    input_tokens: int = Field(ge=0)
    """Total input tokens across all turns."""

    output_tokens: int = Field(ge=0)
    """Total output tokens across all turns."""

    thought_tokens: int | None = Field(default=None, ge=0)
    """Total thought/reasoning tokens."""

    cached_read_tokens: int | None = Field(default=None, ge=0)
    """Total cache read tokens."""

    cached_write_tokens: int | None = Field(default=None, ge=0)
    """Total cache write tokens."""

cached_read_tokens class-attribute instance-attribute

cached_read_tokens: int | None = Field(default=None, ge=0)

Total cache read tokens.

cached_write_tokens class-attribute instance-attribute

cached_write_tokens: int | None = Field(default=None, ge=0)

Total cache write tokens.

input_tokens class-attribute instance-attribute

input_tokens: int = Field(ge=0)

Total input tokens across all turns.

output_tokens class-attribute instance-attribute

output_tokens: int = Field(ge=0)

Total output tokens across all turns.

thought_tokens class-attribute instance-attribute

thought_tokens: int | None = Field(default=None, ge=0)

Total thought/reasoning tokens.

total_tokens class-attribute instance-attribute

total_tokens: int = Field(ge=0)

Sum of all token types across session.

:fa-brands-github: Show source on GitHub