Skip to content

ClaudeCostStateEntry

Base classes

Name Children Inherits
ClaudeStorageModel
clawd_code_sdk.storage.models
Base for transcript models: fields these models don't know are kept.

⋔ Inheritance diagram

graph TD
  1201274323["models.ClaudeCostStateEntry"]
  746985124["models.ClaudeStorageModel"]
  2604142835["base.ClaudeCodeBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  746985124 --> 1201274323
  2604142835 --> 746985124
  3879467795 --> 2604142835
  2751680898 --> 3879467795

🛈 DocStrings

Bases: ClaudeStorageModel

Accumulated cost and duration of the session, for restoring /cost on resume.

Snapshot semantics: the last entry holds the session totals.

Source code in src/clawd_code_sdk/storage/models.py
class ClaudeCostStateEntry(ClaudeStorageModel):
    """Accumulated cost and duration of the session, for restoring ``/cost`` on resume.

    Snapshot semantics: the last entry holds the session totals.
    """

    type: Literal["cost-state"]
    session_id: str
    total_cost_usd: float = Field(alias="totalCostUSD")
    total_api_duration: int = Field(default=0, alias="totalAPIDuration")
    """Milliseconds spent in API requests."""
    total_api_duration_without_retries: int = Field(
        default=0, alias="totalAPIDurationWithoutRetries"
    )
    total_tool_duration: int = 0
    total_duration: int = 0
    total_lines_added: int = 0
    total_lines_removed: int = 0
    start_time: int | None = None
    """Epoch milliseconds."""
    model_usage: dict[str, ClaudeModelCostUsage] = Field(default_factory=dict)
    has_unknown_model_cost: bool = False

start_time class-attribute instance-attribute

start_time: int | None = None

Epoch milliseconds.

total_api_duration class-attribute instance-attribute

total_api_duration: int = Field(default=0, alias='totalAPIDuration')

Milliseconds spent in API requests.

:fa-brands-github: Show source on GitHub