Skip to content

TokenUsage

Source code in docs_src/capo_bedrock_runtime/types/token_usage.py
class TokenUsage(TypedDict, closed=True):
    input_tokens: "int"
    """<p>The number of tokens sent in the request to the model.</p>"""
    output_tokens: "int"
    """<p>The number of tokens that the model generated for the request.</p>"""
    total_tokens: "int"
    """<p>The total of input tokens and tokens generated by the model.</p>"""
    cache_read_input_tokens: NotRequired["int"]
    """<p>The number of input tokens read from the cache for the request.</p>"""
    cache_write_input_tokens: NotRequired["int"]
    """<p>The number of input tokens written to the cache for the request.</p>"""
    cache_details: NotRequired[
        "capo_bedrock_runtime.types.cache_details_list.CacheDetailsList"
    ]
    """<p>Detailed breakdown of cache writes by TTL. Empty if no cache creation occurred. Sorted by TTL duration (1h before 5m).</p>"""

cache_details instance-attribute

cache_details: NotRequired[CacheDetailsList]

Detailed breakdown of cache writes by TTL. Empty if no cache creation occurred. Sorted by TTL duration (1h before 5m).

cache_read_input_tokens instance-attribute

cache_read_input_tokens: NotRequired[int]

The number of input tokens read from the cache for the request.

cache_write_input_tokens instance-attribute

cache_write_input_tokens: NotRequired[int]

The number of input tokens written to the cache for the request.

input_tokens instance-attribute

input_tokens: int

The number of tokens sent in the request to the model.

output_tokens instance-attribute

output_tokens: int

The number of tokens that the model generated for the request.

total_tokens instance-attribute

total_tokens: int

The total of input tokens and tokens generated by the model.