Skip to content

Understand token usage report from Claude Agent SDK #548

@yshuolu

Description

@yshuolu

I got this claude agent message in ResultMessage's metadata:

usage={'input_tokens': 1792, 'cache_creation_input_tokens': 53078, 'cache_read_input_tokens': 1346549, 'output_tokens': 20027, 'server_tool_use': {'web_search_requests': 0, 'web_fetch_requests': 0}, 'service_tier': 'standard', 'cache_creation': {'ephemeral_1h_input_tokens': 0, 'ephemeral_5m_input_tokens': 53078}

The cache_read_input_tokens is about 1.3M!

Is this something I need to worry about? The cached read input tokens seem coming from nowhere as my project codebase is pretty small, only thousands chars in the folder.

And is there a way to see breakdown of cached tokens? Like what files are loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions