Skip to content

Usage

Base classes

Name Children Inherits
AnnotatedObject
aclientp.schema.v2.base
A v2 object with the ``_meta`` extension point.

⋔ Inheritance diagram

graph TD
  95970868362592["common.Usage"]
  95970868359040["base.AnnotatedObject"]
  95970855946400["base.Schema"]
  95970851503232["main.BaseModel"]
  125067848591872["builtins.object"]
  95970868359040 --> 95970868362592
  95970855946400 --> 95970868359040
  95970851503232 --> 95970855946400
  125067848591872 --> 95970851503232

🛈 DocStrings

Bases: AnnotatedObject

UNSTABLE: Token usage of the foreground work that just completed (not cumulative).

Source code in src/aclientp/schema/v2/common.py
class Usage(AnnotatedObject):
    """**UNSTABLE**: Token usage of the foreground work that just completed (not cumulative)."""

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

    input_tokens: int = Field(ge=0)
    """Input tokens."""

    output_tokens: int = Field(ge=0)
    """Output tokens."""

    thought_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
    """Thought/reasoning tokens, if reported."""

    cached_read_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
    """Cache read tokens, if reported."""

    cached_write_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
    """Cache write tokens, if reported."""

cached_read_tokens class-attribute instance-attribute

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

Cache read tokens, if reported.

cached_write_tokens class-attribute instance-attribute

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

Cache write tokens, if reported.

input_tokens class-attribute instance-attribute

input_tokens: int = Field(ge=0)

Input tokens.

output_tokens class-attribute instance-attribute

output_tokens: int = Field(ge=0)

Output tokens.

thought_tokens class-attribute instance-attribute

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

Thought/reasoning tokens, if reported.

total_tokens class-attribute instance-attribute

total_tokens: int = Field(ge=0)

Sum of all token types.

:fa-brands-github: Show source on GitHub