Usage And Cost
Usage And CostCost Report
Get Cost Report
ModelsExpand Collapse
CostReport = object { data, has_more, next_page }
data: array of object { ending_at, results, starting_at }
End of the time bucket (exclusive) in RFC 3339 format.
results: array of object { amount, context_window, cost_type, 6 more } List of cost items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.
List of cost items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.
Cost amount in lowest currency units (e.g. cents) as a decimal string. For example, "123.45" in "USD" represents $1.23.
context_window: "0-200k" or "200k-1M"Input context window used. Null if not grouping by description or for non-token costs.
Input context window used. Null if not grouping by description or for non-token costs.
cost_type: "tokens" or "web_search" or "code_execution"Type of cost. Null if not grouping by description.
Type of cost. Null if not grouping by description.
Currency code for the cost amount. Currently always "USD".
Description of the cost item. Null if not grouping by description.
Model name used. Null if not grouping by description or for non-token costs.
service_tier: "standard" or "batch"Service tier used. Null if not grouping by description or for non-token costs.
Service tier used. Null if not grouping by description or for non-token costs.
token_type: "uncached_input_tokens" or "output_tokens" or "cache_read_input_tokens" or 2 moreType of token. Null if not grouping by description or for non-token costs.
Type of token. Null if not grouping by description or for non-token costs.
ID of the Workspace this cost is associated with. Null if not grouping by workspace or for the default workspace.
Start of the time bucket (inclusive) in RFC 3339 format.
Indicates if there are more results.
Token to provide in as page in the subsequent request to retrieve the next page of data.
Usage And CostUsage Report
Get Claude Code Usage Report
Get Messages Usage Report
ModelsExpand Collapse
ClaudeCodeUsageReport = object { data, has_more, next_page }
data: array of object { actor, core_metrics, customer_type, 6 more } List of Claude Code usage records for the requested date.
List of Claude Code usage records for the requested date.
actor: object { email_address, type } or object { api_key_name, type } The user or API key that performed the Claude Code actions.
The user or API key that performed the Claude Code actions.
UserActor = object { email_address, type }
Email address of the user who performed Claude Code actions.
type: "user_actor"
APIActor = object { api_key_name, type }
Name of the API key used to perform Claude Code actions.
type: "api_actor"
core_metrics: object { commits_by_claude_code, lines_of_code, num_sessions, pull_requests_by_claude_code } Core productivity metrics measuring Claude Code usage and impact.
Core productivity metrics measuring Claude Code usage and impact.
Number of git commits created through Claude Code's commit functionality.
lines_of_code: object { added, removed } Statistics on code changes made through Claude Code.
Statistics on code changes made through Claude Code.
Total number of lines of code added across all files by Claude Code.
Total number of lines of code removed across all files by Claude Code.
Number of distinct Claude Code sessions initiated by this actor.
Number of pull requests created through Claude Code's PR functionality.
customer_type: "api" or "subscription"Type of customer account (api for API customers, subscription for Pro/Team customers).
Type of customer account (api for API customers, subscription for Pro/Team customers).
UTC date for the usage metrics in YYYY-MM-DD format.
model_breakdown: array of object { estimated_cost, model, tokens } Token usage and cost breakdown by AI model used.
Token usage and cost breakdown by AI model used.
estimated_cost: object { amount, currency } Estimated cost for using this model
Estimated cost for using this model
Estimated cost amount in minor currency units (e.g., cents for USD).
Currency code for the estimated cost (e.g., 'USD').
Name of the AI model used for Claude Code interactions.
tokens: object { cache_creation, cache_read, input, output } Token usage breakdown for this model
Token usage breakdown for this model
Number of cache creation tokens consumed by this model.
Number of cache read tokens consumed by this model.
Number of input tokens consumed by this model.
Number of output tokens generated by this model.
ID of the organization that owns the Claude Code usage.
Type of terminal or environment where Claude Code was used.
tool_actions: map[object { accepted, rejected } ]Breakdown of tool action acceptance and rejection rates by tool type.
Breakdown of tool action acceptance and rejection rates by tool type.
Number of tool action proposals that the user accepted.
Number of tool action proposals that the user rejected.
subscription_type: optional "enterprise" or "team"Subscription tier for subscription customers. Null for API customers.
Subscription tier for subscription customers. Null for API customers.
True if there are more records available beyond the current page.
Opaque cursor token for fetching the next page of results, or null if no more pages are available.
MessagesUsageReport = object { data, has_more, next_page }
data: array of object { ending_at, results, starting_at }
End of the time bucket (exclusive) in RFC 3339 format.
results: array of object { api_key_id, cache_creation, cache_read_input_tokens, 7 more } List of usage items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.
List of usage items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.
ID of the API key used. Null if not grouping by API key or for usage in the Anthropic Console.
cache_creation: object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens } The number of input tokens for cache creation.
The number of input tokens for cache creation.
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens read from the cache.
context_window: "0-200k" or "200k-1M"Context window used. Null if not grouping by context window.
Context window used. Null if not grouping by context window.
Model used. Null if not grouping by model.
The number of output tokens generated.
server_tool_use: object { web_search_requests } Server-side tool usage metrics.
Server-side tool usage metrics.
The number of web search requests made.
service_tier: "standard" or "batch" or "priority" or "priority_on_demand"Service tier used. Null if not grouping by service tier.
Service tier used. Null if not grouping by service tier.
The number of uncached input tokens processed.
ID of the Workspace used. Null if not grouping by workspace or for the default workspace.
Start of the time bucket (inclusive) in RFC 3339 format.
Indicates if there are more results.
Token to provide in as page in the subsequent request to retrieve the next page of data.