Home / File/ beta_usage.py — anthropic-sdk-python Source File

beta_usage.py — anthropic-sdk-python Source File

Architecture documentation for beta_usage.py, a python file in the anthropic-sdk-python codebase. 8 imports, 2 dependents.

File python AnthropicClient 8 imports 2 dependents 1 classes

Entity Profile

Dependency Diagram

graph LR
  46e8a7de_a05a_d9d7_1570_a70571fd7b00["beta_usage.py"]
  c14e2467_291d_6c7c_2b25_9a24e81f8565["_models"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> c14e2467_291d_6c7c_2b25_9a24e81f8565
  282148a6_0b81_0191_bdbc_8d40c14228ac["beta_cache_creation.py"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 282148a6_0b81_0191_bdbc_8d40c14228ac
  524d8b1b_8108_1804_0769_0009cff2d3fc["BetaCacheCreation"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 524d8b1b_8108_1804_0769_0009cff2d3fc
  fba56da2_5b06_a909_4eed_f4898004d572["beta_iterations_usage.py"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> fba56da2_5b06_a909_4eed_f4898004d572
  2a240ea1_c2a5_d85d_04ad_bd6cc577d381["beta_server_tool_usage.py"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 2a240ea1_c2a5_d85d_04ad_bd6cc577d381
  87f0ec79_c29f_61c0_751a_1582c7085768["BetaServerToolUsage"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 87f0ec79_c29f_61c0_751a_1582c7085768
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"]
  46e8a7de_a05a_d9d7_1570_a70571fd7b00 --> 37c05070_ca59_d596_7250_de9d1939227f
  65f3d77c_c1b2_82e1_f9d7_1e7e05f3fdfd["__init__.py"]
  65f3d77c_c1b2_82e1_f9d7_1e7e05f3fdfd --> 46e8a7de_a05a_d9d7_1570_a70571fd7b00
  20977b2a_1890_cfe8_7dca_f3846f5fda73["beta_message.py"]
  20977b2a_1890_cfe8_7dca_f3846f5fda73 --> 46e8a7de_a05a_d9d7_1570_a70571fd7b00
  style 46e8a7de_a05a_d9d7_1570_a70571fd7b00 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

from ..._models import BaseModel
from .beta_cache_creation import BetaCacheCreation
from .beta_iterations_usage import BetaIterationsUsage
from .beta_server_tool_usage import BetaServerToolUsage

__all__ = ["BetaUsage"]


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."""

Classes

Frequently Asked Questions

What does beta_usage.py do?
beta_usage.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain.
What does beta_usage.py depend on?
beta_usage.py imports 8 module(s): BetaCacheCreation, BetaServerToolUsage, _models, beta_cache_creation.py, beta_iterations_usage.py, beta_server_tool_usage.py, typing, typing_extensions.
What files import beta_usage.py?
beta_usage.py is imported by 2 file(s): __init__.py, beta_message.py.
Where is beta_usage.py in the architecture?
beta_usage.py is located at src/anthropic/types/beta/beta_usage.py (domain: AnthropicClient, directory: src/anthropic/types/beta).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free