BetaUsage Class — anthropic-sdk-python Architecture
Architecture documentation for the BetaUsage class in beta_usage.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD ebe7ae73_c308_f5ca_225a_7053dd679376["BetaUsage"] 17ce5647_6f06_0676_a4a5_e378a3f57cb1["BaseModel"] ebe7ae73_c308_f5ca_225a_7053dd679376 -->|extends| 17ce5647_6f06_0676_a4a5_e378a3f57cb1 46e8a7de_a05a_d9d7_1570_a70571fd7b00["beta_usage.py"] ebe7ae73_c308_f5ca_225a_7053dd679376 -->|defined in| 46e8a7de_a05a_d9d7_1570_a70571fd7b00
Relationship Graph
Source Code
src/anthropic/types/beta/beta_usage.py lines 14–51
class BetaUsage(BaseModel):
cache_creation: Optional[BetaCacheCreation] = None
"""Breakdown of cached tokens by TTL"""
cache_creation_input_tokens: Optional[int] = None
"""The number of input tokens used to create the cache entry."""
cache_read_input_tokens: Optional[int] = None
"""The number of input tokens read from the cache."""
inference_geo: Optional[str] = None
"""The geographic region where inference was performed for this request."""
input_tokens: int
"""The number of input tokens which were used."""
iterations: Optional[BetaIterationsUsage] = None
"""Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token
counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
"""
output_tokens: int
"""The number of output tokens which were used."""
server_tool_use: Optional[BetaServerToolUsage] = None
"""The number of server tool requests."""
service_tier: Optional[Literal["standard", "priority", "batch"]] = None
"""If the request used the priority, standard, or batch tier."""
speed: Optional[Literal["standard", "fast"]] = None
"""The inference speed mode used for this request."""
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the BetaUsage class?
BetaUsage is a class in the anthropic-sdk-python codebase, defined in src/anthropic/types/beta/beta_usage.py.
Where is BetaUsage defined?
BetaUsage is defined in src/anthropic/types/beta/beta_usage.py at line 14.
What does BetaUsage extend?
BetaUsage extends BaseModel.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free