---
title: Cost Report
url: https://platform.claude.com/docs/en/api/java/beta/organization/analytics/cost_report
---

# Cost Report

## Get Cost Over Time

`CostReportListPage beta().organization().analytics().costReport().list(params, requestOptions = RequestOptions.none())`

**GET** `/v1/organizations/analytics/cost_report`

Get cost in USD over time across a date range.

Returns cost bucketed by minute, hour, or day, optionally broken down by
product, model, context window, inference region, speed, cost type, or
token type. Available to organizations on a Claude Enterprise plan.
Requires an API key with the `read:analytics` scope.

### Parameters

- `CostReportListParams params`

  - `LocalDateTime 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.

    format: date-time

  - `Optional<BucketWidth> bucketWidth` (query parameter)

    Time bucket granularity.

    - `DAY("1d")`

    - `HOUR("1h")`

    - `MINUTE("1m")`

  - `Optional<List<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.

    maxItems: 100

    - `DM("dm")`

    - `ENGAGED("engaged")`

    - `MONITORING("monitoring")`

    - `PROACTIVE("proactive")`

    - `SCHEDULED("scheduled")`

  - `Optional<List<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.

    maxItems: 100

  - `Optional<List<BetaAnalyticsContextWindow>> contextWindows` (query parameter)

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

    maxItems: 100

    - `FROM_0_TO_200K("0-200k")`

    - `FROM_200K_TO_1_M("200k-1M")`

  - `Optional<LocalDateTime> 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.

    format: date-time

  - `Optional<List<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.

    maxItems: 100

    - `CLAUDE_TAG_CATEGORY("claude_tag_category")`

    - `CLAUDE_TAG_USER_ID("claude_tag_user_id")`

    - `CONTEXT_WINDOW("context_window")`

    - `COST_TYPE("cost_type")`

    - `INFERENCE_GEO("inference_geo")`

    - `MODEL("model")`

    - `PRODUCT("product")`

    - `RBAC_GROUP_ID("rbac_group_id")`

    - `SLACK_CHANNEL_ID("slack_channel_id")`

    - `SPEED("speed")`

    - `TOKEN_TYPE("token_type")`

  - `Optional<List<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.

    maxItems: 100

    - `GLOBAL("global")`

    - `NOT_AVAILABLE("not_available")`

    - `US("us")`

  - `Optional<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).

    minimum: 1

  - `Optional<List<String>> models` (query parameter)

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

    maxItems: 100

  - `Optional<String> page` (query parameter)

    Opaque cursor from a previous response's `next_page` field.

  - `Optional<List<BetaAnalyticsProductFilter>> products` (query parameter)

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

    maxItems: 100

    - `CHAT("chat")`

    - `CHAT_COWORK_UNIFIED("chat_cowork_unified")`

    - `CLAUDE_TAG("claude-tag")`

    - `CLAUDE_CODE("claude_code")`

    - `CLAUDE_DESIGN("claude_design")`

    - `CLAUDE_IN_CHROME("claude_in_chrome")`

    - `COWORK("cowork")`

    - `OFFICE_AGENT("office_agent")`

  - `Optional<List<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.

    maxItems: 100

  - `Optional<List<String>> slackChannelIds` (query parameter)

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

    maxItems: 100

  - `Optional<List<Speed>> speeds` (query parameter)

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

    maxItems: 100

    - `FAST("fast")`

    - `STANDARD("standard")`

  - `Optional<List<String>> userIds` (query parameter)

    Filter to specific users by tagged user ID.

    maxItems: 100

### Returns

- `class BetaAnalyticsCostReportTimeBucket`

  - `LocalDateTime endingAt`

    End of the time bucket (exclusive) in RFC 3339 format.

    format: date-time

  - `List<BetaAnalyticsCostBucketedResult> results`

    Rows for this time bucket. Empty when the bucket has no data; otherwise a single combined row when `group_by[]` is omitted, or one row per group (subject to the per-bucket group cap described on the `group_by[]` parameter).

    - `String amount`

      Amount (post-discount, pre-credit) in fractional cents.

    - `Optional<BetaAnalyticsClaudeTagCategory> claudeTagCategory`

      Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed Claude in a channel or thread), `proactive` (Claude responded without being addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching a channel it was asked to monitor), or `dm` (direct messages with Claude). Populated only when `claude_tag_category` is in `group_by[]`; null for usage that is not Claude Tag. Direct-message usage is billed to the individual user and is reported under that user's product, not under `claude-tag`. New categories may be added over time.

      - `DM("dm")`

      - `ENGAGED("engaged")`

      - `MONITORING("monitoring")`

      - `PROACTIVE("proactive")`

      - `SCHEDULED("scheduled")`

    - `Optional<String> claudeTagUserId`

      Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude in Slack) usage is attributed to, not a claude.ai user ID. Populated only when `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag and for Claude Tag usage that is not attributed to a single user (for example `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum to less than the Claude Tag total. Cannot be combined with `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.

    - `Optional<BetaAnalyticsContextWindow> contextWindow`

      Context-window pricing tier of the usage or cost. Null unless `context_window` is in `group_by[]`; it can also be null on grouped rows with no context-window tier, such as code execution.

      - `FROM_0_TO_200K("0-200k")`

      - `FROM_200K_TO_1_M("200k-1M")`

    - `Optional<BetaAnalyticsCostType> costType`

      Cost component when `group_by[]=cost_type`; null otherwise (amount is the combined total).

      - `CODE_EXECUTION("code_execution")`

      - `TOKENS("tokens")`

      - `WEB_SEARCH("web_search")`

    - `String currency`

      Currency code for the cost amount. Currently always `"USD"`.

    - `Optional<InferenceGeo> inferenceGeo`

      Inference region of the usage or cost. Null unless `inference_geo` is in `group_by[]`; it can also be null on grouped rows where the region is not set (the rows that `inference_geos[]=not_available` matches).

      - `GLOBAL("global")`

      - `US("us")`

    - `String listAmount`

      List-price amount (pre-discount) in fractional cents.

    - `Optional<String> model`

      Model that produced the usage or cost, as a model name in the form the `models[]` filter accepts (for example, `claude-opus-5-5`). Null unless `model` is in `group_by[]`; it can also be null on grouped rows whose usage or cost is not attributed to a specific model, such as code execution.

    - `Optional<String> product`

      Product surface that produced the usage or cost. Null unless product is in `group_by[]`; it can also be null on grouped rows whose usage cannot be attributed to a known surface. Values include `chat`, `claude_code`, `cowork`, `office_agent`, `claude_in_chrome`, `claude_design`, `claude-tag`, and `chat_cowork_unified`. `claude-tag` is Claude Tag, the Claude product in Slack. `chat_cowork_unified` is Chat and Cowork unified, Cowork's features inside claude.ai chat: chat and Cowork usage by a member who has it turned on is reported under this value instead of `chat` or `cowork`. It is accepted as a filter only on deployments that offer Chat and Cowork unified. Some unattributed usage is reported as "other".

    - `Optional<String> rbacGroupId`

      RBAC group (team) the usage is attributed to, in the public tagged `rbac_group_...` spelling — the same spelling the activity resources use for this key, so the same team has one id across resources and it round-trips as an `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in `group_by[]`. Any-membership semantics: a user in several groups contributes their full usage to each of those groups' rows, so the named-group rows overlap and their sum can exceed the org total. A null value is the single unassigned row: users in no group on that (UTC) day. For the true org total, run the same query without `group_by[]`.

    - `Optional<Long> requests`

      Number of API requests in this row's scope. Null when `group_by` includes `cost_type` or `token_type` (the count has no per-component attribution; read it from the ungrouped response). For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with `product: null`).

    - `Optional<String> slackChannelId`

      Slack channel the usage originated from. Populated only when `slack_channel_id` is in `group_by[]`; null for usage outside Slack (and for rows recorded before channel attribution was enabled).

    - `Optional<Speed> speed`

      Inference speed mode of the usage or cost: `fast` or `standard`. Null unless `speed` is in `group_by[]`.

      - `FAST("fast")`

      - `STANDARD("standard")`

    - `Optional<BetaAnalyticsTokenType> tokenType`

      Token type when `group_by[]=token_type` and `cost_type=tokens`; null otherwise.

      - `CACHE_CREATION_EPHEMERAL_1H_INPUT_TOKENS("cache_creation.ephemeral_1h_input_tokens")`

      - `CACHE_CREATION_EPHEMERAL_5M_INPUT_TOKENS("cache_creation.ephemeral_5m_input_tokens")`

      - `CACHE_READ_INPUT_TOKENS("cache_read_input_tokens")`

      - `OUTPUT_TOKENS("output_tokens")`

      - `UNCACHED_INPUT_TOKENS("uncached_input_tokens")`

  - `LocalDateTime startingAt`

    Start of the time bucket (inclusive) in RFC 3339 format.

    format: date-time

### Example

```java
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.analytics.costreport.CostReportListPage;
import com.anthropic.models.beta.organization.analytics.costreport.CostReportListParams;
import java.time.OffsetDateTime;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        CostReportListParams params = CostReportListParams.builder()
            .startingAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
            .build();
        CostReportListPage page = client.beta().organization().analytics().costReport().list(params);
    }
}
```

#### Response (200)

```json
{
  "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"
}
```
