Claude Platform Docs

用量

按维度获取令牌用量
beta.organization.analytics.usage.list(**kwargs) -> SyncReportPageCursor[BetaAnalyticsUsageItem]
GET/v1/organizations/analytics/usage
Requires anthropic-beta: analytics-usage-cost-2026-08-24. Learn how to send beta headers.

Get token usage across a date range, broken out by dimension.

Models
class BetaAnalyticsUsageGroup: actor; actor_type; agent_id; ... # 17 more

The dimension values one usage row is broken out by; each is null unless its dimension is in group_by[].

type BetaAnalyticsUsageGroupBy = Literal["actor", "actor_type", "agent_id", 17 more]
One of the following:
class BetaAnalyticsUsageItem: ending_at; group; starting_at; usage
class BetaAnalyticsUsageMetrics: cache_creation; cache_read_input_tokens; output_tokens; ... # 4 more

The token usage of one row.

cache_creation: BetaCacheCreation

The number of input tokens for cache creation.

ephemeral_1h_input_tokens: int

The number of input tokens used to create the 1 hour cache entry.

default0
minimum0
ephemeral_5m_input_tokens: int

The number of input tokens used to create the 5 minute cache entry.

default0
minimum0
cache_read_input_tokens: int

The number of input tokens read from the cache.

output_tokens: int

The number of output tokens generated.

requests: Optional[int]

Number of API requests in this row's scope. For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with product: null).

Server-side tool usage metrics.

web_search_requests: int

The number of web search requests made.

total_tokens: int

Total token count across all token types. This is the value the default order_by (total_tokens) sorts on.

uncached_input_tokens: int

The number of uncached input tokens processed.

type BetaAnalyticsUsageOrderBy = Literal["output_tokens", "requests", "time", 2 more]
One of the following:
"output_tokens"
"requests"
"time"
"total_tokens"
"uncached_input_tokens"