Skip to content

UsageUpdate

Base classes

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

⋔ Inheritance diagram

graph TD
  95970869808944["session_updates.UsageUpdate"]
  95970868359040["base.AnnotatedObject"]
  95970855946400["base.Schema"]
  95970851503232["main.BaseModel"]
  125067848591872["builtins.object"]
  95970868359040 --> 95970869808944
  95970855946400 --> 95970868359040
  95970851503232 --> 95970855946400
  125067848591872 --> 95970851503232

🛈 DocStrings

Bases: AnnotatedObject

Context window and cost of the session.

Source code in src/aclientp/schema/v2/session_updates.py
class UsageUpdate(AnnotatedObject):
    """Context window and cost of the session."""

    session_update: Literal["usage_update"] = Field(default="usage_update", init=False)

    used: int = Field(ge=0)
    """Tokens currently in the context."""

    size: int = Field(ge=0)
    """Total context window size in tokens."""

    cost: Cost | MISSING | None = MISSING
    """Cumulative session cost; omitted leaves the last cost unchanged, ``None`` clears it."""

cost class-attribute instance-attribute

cost: Cost | MISSING | None = MISSING

Cumulative session cost; omitted leaves the last cost unchanged, None clears it.

size class-attribute instance-attribute

size: int = Field(ge=0)

Total context window size in tokens.

used class-attribute instance-attribute

used: int = Field(ge=0)

Tokens currently in the context.

:fa-brands-github: Show source on GitHub