ModelUsageActivityRecord#

Build extensions, choose hooks, and manage request-scoped state. See the guide.

class zett_agent.extensions.usage_activity.ModelUsageActivityRecord(*, session_id, request_id, provider, model, occurred_at, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, reasoning_tokens)[source]#

One completed model request recorded for activity visualization.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • session_id (str)

  • request_id (str | None)

  • provider (str | None)

  • model (str | None)

  • occurred_at (datetime)

  • input_tokens (Annotated[int, Ge(ge=0)])

  • output_tokens (Annotated[int, Ge(ge=0)])

  • cache_read_tokens (Annotated[int, Ge(ge=0)])

  • cache_write_tokens (Annotated[int, Ge(ge=0)])

  • reasoning_tokens (Annotated[int, Ge(ge=0)])

property total_tokens: int#

Return the tokens represented by this request.

Fields#

session_id (required)

See the typed model signature for this field.

request_id (required)

See the typed model signature for this field.

provider (required)

See the typed model signature for this field.

model (required)

See the typed model signature for this field.

occurred_at (required)

See the typed model signature for this field.

input_tokens (required)

See the typed model signature for this field.

output_tokens (required)

See the typed model signature for this field.

cache_read_tokens (required)

See the typed model signature for this field.

cache_write_tokens (required)

See the typed model signature for this field.

reasoning_tokens (required)

See the typed model signature for this field.