Claude Platform Docs

取得隨時間變化的成本

CostReportListPage Beta.Organization.Analytics.CostReport.List(parameters, cancellationToken = default)
GET/v1/organizations/analytics/cost_report

[舊版] 取得某個日期範圍內隨時間變化的成本(以美元計)。

傳回依分鐘、小時或天分桶的成本,可選擇依一或多個 group_by[] 維度(例如模型或成本類型)細分。適用於採用 Claude Enterprise 方案的組織。需要具有 read:analytics 範圍的 API 金鑰。

此端點屬於舊版的 Claude Enterprise 用量與成本報告。新的整合請改用用量與成本分析 API 中的 GET /v1/organizations/analytics/cost。若要遷移現有整合,請參閱從 Claude Enterprise 用量與成本報告遷移。

Parameters
CostReportListParams parameters
required DateTimeOffset startingAt⁠Query parameter

Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days and no earlier than 2026-01-01T00:00:00Z.

formatdate-time
BucketWidth bucketWidth⁠Query parameter

Time bucket granularity.

Day("1d")
Hour("1h")
Minute("1m")
IReadOnlyList<BetaAnalyticsClaudeTagCategory>? claudeTagCategories⁠Query parameter

Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage with no category never matches. dm usage is reported under the user's product rather than claude-tag, so combining this filter with products[]=claude-tag excludes it. Use group_by[]=claude_tag_category to break out per-category values.

maxItems100
Dm("dm")
Engaged("engaged")
Monitoring("monitoring")
Proactive("proactive")
Scheduled("scheduled")
IReadOnlyList<string>? claudeTagUserIds⁠Query parameter

Filter to Claude Tag (Claude in Slack) usage attributed to specific Slack users, by Slack user ID (for example U0123ABCDEF), not claude.ai user ID. Usage that is not Claude Tag, and Claude Tag usage not attributed to a single user, never matches. Use group_by[]=claude_tag_user_id to break out per-user values.

maxItems100
IReadOnlyList<BetaAnalyticsContextWindow>? contextWindows⁠Query parameter

Filter to specific context-window pricing tiers. Use group_by[]=context_window to break out per-tier values.

maxItems100
From0To200k("0-200k")
From200kTo1M("200k-1M")
DateTimeOffset? endingAt⁠Query parameter

End of range, exclusive. When omitted, defaults to the earlier of now and starting_at + 31 days. The range may span at most 31 days.

formatdate-time
IReadOnlyList<GroupBy>? groupBy⁠Query parameter

Dimensions to break each time bucket out by. Defaults to no grouping (one total per bucket). Each bucket reports at most its top 100 groups; a group beyond that cap has no row in that bucket (there is no remainder row), so grouped buckets are not exhaustive when a dimension has more than 100 distinct values.

maxItems100
ClaudeTagCategory("claude_tag_category")
ClaudeTagUserID("claude_tag_user_id")
ContextWindow("context_window")
CostType("cost_type")
InferenceGeo("inference_geo")
Model("model")
Product("product")
RbacGroupID("rbac_group_id")
SlackChannelID("slack_channel_id")
Speed("speed")
TokenType("token_type")
IReadOnlyList<BetaAnalyticsInferenceGeoFilter>? inferenceGeos⁠Query parameter

Filter to specific inference regions. not_available matches rows where the region is unset. Use group_by[]=inference_geo to break out per-region values.

maxItems100
Global("global")
NotAvailable("not_available")
Us("us")
long? limit⁠Query parameter

Maximum number of time buckets per page. Defaults and caps vary by bucket_width (1d: default 7, max 31; 1h: default 24, max 168; 1m: default 60, max 256).

minimum1
IReadOnlyList<string>? models⁠Query parameter

Models to include. Defaults to all models. Use group_by[]=model to break out per-model values.

maxItems100
string? page⁠Query parameter

Opaque cursor from a previous response's next_page field.

IReadOnlyList<BetaAnalyticsProductFilter>? products⁠Query parameter

Product surfaces to include. Defaults to all products. Use group_by[]=product to break out per-product values.

maxItems100
Chat("chat")
ChatCoworkUnified("chat_cowork_unified")
ClaudeTag("claude-tag")
ClaudeCode("claude_code")
ClaudeDesign("claude_design")
ClaudeInChrome("claude_in_chrome")
Cowork("cowork")
OfficeAgent("office_agent")
IReadOnlyList<string>? rbacGroupIds⁠Query parameter

Filter to usage attributed to specific RBAC groups. Accepts tagged RBAC group IDs (rbac_group_...) or bare group UUIDs. A row matches when the user belonged to any of the listed groups on the (UTC) day the usage occurred; usage with no group attribution never matches.

maxItems100
IReadOnlyList<string>? slackChannelIds⁠Query parameter

Filter to usage originating from specific Slack channels. Use group_by[]=slack_channel_id to break out per-channel values.

maxItems100
IReadOnlyList<Speed>? speeds⁠Query parameter

Filter to fast or standard inference mode. Use group_by[]=speed to break out per-mode values.

maxItems100
Fast("fast")
Standard("standard")
IReadOnlyList<string>? userIds⁠Query parameter

Filter to specific users by tagged user ID.

maxItems100
Returns
class BetaAnalyticsCostReportTimeBucket { EndingAt; Results; StartingAt; }
取得隨時間變化的成本
using System;
using Anthropic.Models.Beta.Organization.Analytics.CostReport;

CostReportListParams parameters = new()
{
    StartingAt = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z")
};

var page = await client.Beta.Organization.Analytics.CostReport.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
Returns Examples
Response 200
{
  "data": [
    {
      "ending_at": "2019-12-27T18:11:19.117Z",
      "results": [
        {
          "amount": "amount",
          "claude_tag_category": "dm",
          "claude_tag_user_id": "U0123ABCDEF",
          "context_window": "0-200k",
          "cost_type": "code_execution",
          "currency": "USD",
          "inference_geo": "global",
          "list_amount": "list_amount",
          "model": "claude-opus-5-5",
          "product": "chat",
          "rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",
          "requests": 0,
          "slack_channel_id": "C0123ABCDEF",
          "speed": "fast",
          "token_type": "cache_creation.ephemeral_1h_input_tokens"
        }
      ],
      "starting_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "data_refreshed_at": "2019-12-27T18:11:19.117Z",
  "has_more": true,
  "next_page": "next_page",
  "organization_id": "org_013FP9SaFPBg7Kw7fetjn6cF"
}