用量
按维度获取令牌用量
UsageListPage Beta.Organization.Analytics.Usage.List(parameters, cancellationToken = default)anthropic-beta: analytics-usage-cost-2026-08-24. How to send beta headers获取某个日期范围内按维度细分的令牌用量。
Models
class BetaAnalyticsUsageGroup { Actor; ActorType; AgentID; /* 16 more */ }The dimension values one usage row is broken out by; each is null
unless its dimension is in group_by[].
The dimension values one usage row is broken out by; each is null
unless its dimension is in group_by[].
enum BetaAnalyticsUsageGroupBy
class BetaAnalyticsUsageItem { EndingAt; Group; StartingAt; Usage; }
class BetaAnalyticsUsageMetrics { CacheCreation; CacheReadInputTokens; OutputTokens; /* 4 more */ }The token usage of one row.
The token usage of one row.
required BetaCacheCreation CacheCreationThe number of input tokens for cache creation.
The number of input tokens for cache creation.
required long Ephemeral1hInputTokensThe number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
required long Ephemeral5mInputTokensThe number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens read from the cache.
The number of output tokens generated.
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).
required BetaAnalyticsServerToolUse ServerToolUseServer-side tool usage metrics.
Server-side tool usage metrics.
The number of web search requests made.
Total token count across all token types. This is the value the default order_by (total_tokens) sorts on.
The number of uncached input tokens processed.