Skip to content
, ,

How to Track and Cut Claude API Costs: Console, Spend Limits and Analytics API

11–16 minutes
Excited woman in orange blazer holding card with Claude logo at a tech conference, text Track every Claude dollar

Anthropic launched the Usage and Cost Analytics API in beta on October 29, 2026.

It breaks down Claude spend by model, workspace, API key and the person or service account behind each request, for both Claude Console and Claude Enterprise organizations.

This guide shows how to use it, plus every built-in tool you have to set spend limits, get alerts and cut your Claude API bill.

TLDR

  • New endpoints: GET /v1/organizations/analytics/usage and GET /v1/organizations/analytics/cost, with the beta header analytics-usage-cost-2026-08-24.
  • You need an Admin API key (Console) or a read:analytics key (Enterprise).
  • Group by up to 5 dimensions: model, workspace, API key, actor (person or service account), service tier and more.
  • Data refreshes within about 4 hours, up to 24 hours. The old Usage and Cost API is now legacy but still supported.
  • Set an org spend limit on the Billing page and per-workspace limits plus email notifications on the Workspaces page.
  • Biggest savings: right model, prompt caching, Batch API (50% off) and smaller outputs.

What Is New in Claude Cost Tracking

Before this release, Console users had the Usage and Cost API (the usage_report and cost_report endpoints), and Enterprise had its own set of analytics reports. Each worked a little differently, and the Enterprise reports only returned the top 100 groups per time bucket.

The new Usage and Cost Analytics API gives both organization types one shared design. The same endpoints, parameters and response fields serve Console and Enterprise. You can rank rows by tokens, requests or dollars, and you get every combination that had usage, not just the top 100.

The old APIs are now called legacy. Anthropic says they all remain supported, so nothing breaks today. But new dashboards should use the new endpoints.

Item Detail
Launch October 29, 2026 (beta)
Beta header anthropic-beta: analytics-usage-cost-2026-08-24
Usage endpoint GET /v1/organizations/analytics/usage (tokens and requests)
Cost endpoint GET /v1/organizations/analytics/cost (USD)
Console auth Admin API key, or OAuth with org:admin scope
Enterprise auth Key with read:analytics scope, created in claude.ai by the primary owner
Max range per request 31 days (24 hours with 1-minute buckets)
Lookback Last 365 days, and not before January 1, 2026
Freshness Usually within 4 hours, up to 24 hours

Where to See Spend in the Console

If you only need a quick look, you do not need the API at all. The Claude Console has three pages that matter:

  • Usage at platform.claude.com/usage shows token usage.
  • Cost at platform.claude.com/cost shows spend in dollars.
  • Billing at platform.claude.com/settings/billing shows your credit balance, invoices, auto-reload and the organization spend limit.

Anthropic’s docs say the Analytics API shows similar data to the Usage and Cost pages. The API is useful when you want to pull numbers into your own dashboard, a spreadsheet, or a nightly report in Slack.

You need the Admin or Billing role in the Console to buy credits, set auto-reload or change payment details. Admin API keys are not available to individual accounts. You first need to set up an organization on the Organization settings page.

How to Set Spend Limits

There are two layers of spend limits in the Console: one for the whole organization and one for each workspace.

Organization spend limit

Every usage tier has a monthly spend cap. You can set your own lower limit under it.

Usage tier Monthly spend cap
Start $500
Build $1,000
Scale $200,000
Custom No fixed cap, set with your account team
  1. Open the Billing page at platform.claude.com/settings/billing.
  2. Find the Spend limits section.
  3. Click Adjust limit, or Set limit if none is set yet.
  4. Enter the new monthly amount. It cannot be higher than your tier’s cap.
  5. Save. Spend resets at the start of each calendar month.

Workspace spend limit

Workspaces let you split one organization into projects or teams, each with its own keys. This is the cleanest way to give a team a budget.

  1. Go to the Workspaces page at platform.claude.com/settings/workspaces.
  2. Click the workspace you want to limit.
  3. In the side panel, click Spend limits.
  4. Click Change limit and enter a monthly amount. It must be lower than the organization limit. If you leave it unset, it uses the organization limit.
  5. Save. Repeat for each workspace.

Two limits to know: you cannot set a spend limit on the Default workspace, and each organization can have up to 100 workspaces. So put real workloads in named workspaces, not the default one.

You can also set per-workspace rate limits on the Rate limits page (platform.claude.com/usage/limits). Pick the workspace, click Edit next to a model, and set lower limits. That stops one runaway script from eating the whole organization’s throughput.

Enterprise per-user limits

Claude Enterprise has a separate Spend Limits API with per-user overrides (POST /v1/organizations/spend_limits). It needs usage credits turned on and an Admin API key with write:spend_limits. Seat-tier, group and organization defaults are set in claude.ai Organization settings.

Amounts are strings in cents, so "75000" means $750, and the only period is monthly. This API is not available to Console organizations.

Budget Alerts and Notifications

The Console’s built-in alert lives on each workspace. Here is how to turn it on.

  1. Open platform.claude.com/settings/workspaces and select a workspace.
  2. Click Spend limits in the panel.
  3. Click + Add notification.
  4. Enter the dollar amount that should trigger an email.
  5. Add more notifications for other levels, for example 50%, 80% and 100% of your budget.

Two more safety nets help. First, auto-reload on the Billing page keeps credits topped up, so production never stops from an empty balance. Click Set up auto-reload, enter the trigger balance and the target balance, then click Turn on.

Second, a spend limit is itself a hard alert: when you hit it, the API stops serving requests.

Tip: If you want alerts by API key or by person, build them on the Analytics API. A simple daily job can pull cost grouped by api_key_id and post to Slack when any key passes a threshold.

Warning: Remember the data can lag by up to 24 hours, so this is a daily guard, not a real-time kill switch. The spend limit is your real-time guard.

Using the Usage and Cost Analytics API

Here is the full setup, from key to first report.

  1. Make sure your Console account is an organization, not an individual account.
  2. Create an Admin API key in the Console. Only organization admins can do this. On Enterprise, the primary owner creates a key with the read:analytics scope in claude.ai after the Analytics API is enabled.
  3. Store the key in a secrets manager and set an expiry date. Give the reporting job its own key.
  4. Update the Anthropic SDK, which exposes client.beta.organization.analytics and fetches all pages for you.
  5. Send your first request with a time range, an optional bucket width and a group_by.
  6. Divide amount by 100 to get dollars. Cost amounts are strings in cents.

Daily token usage by model, from Anthropic’s docs:

import anthropic

client = anthropic.Anthropic()  # uses an Admin API key

rows = client.beta.organization.analytics.usage.list(
    starting_at="2026-09-01T00:00:00Z",
    ending_at="2026-09-08T00:00:00Z",
    time_bucket_width="1d",
    group_by=["model"],
    limit=10,
)

for row in rows:
    print(f"{row.starting_at} {row.group.model}: {row.usage.total_tokens}")

Monthly cost split by model, cost type and token type:

rows = client.beta.organization.analytics.cost.list(
    starting_at="2026-09-01T00:00:00Z",
    ending_at="2026-10-01T00:00:00Z",
    group_by=["model", "cost_type", "token_type"],
)

for row in rows:
    dollars = float(row.cost.amount) / 100
    print(f"{row.group.model} {row.group.cost_type} {row.group.token_type}: ${dollars:.2f}")

Top 25 people or service accounts by request count:

rows = client.beta.organization.analytics.usage.list(
    starting_at="2026-09-01T00:00:00Z",
    ending_at="2026-10-01T00:00:00Z",
    group_by=["actor"],
    order_by="requests",
    limit=25,
)

for row in rows:
    print(f"{row.group.actor}: {row.usage.requests}")

The same call with curl. Use --globoff so the brackets are not treated as patterns:

curl --globoff "https://api.anthropic.com/v1/organizations/analytics/cost?starting_at=2026-10-01T00:00:00Z&ending_at=2026-11-01T00:00:00Z&group_by[]=api_key_id&limit=100" \
  -H "anthropic-version: 2026-10-21" \
  -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
  -H "x-api-key: $ANTHROPIC_ADMIN_KEY"

Each response has data, has_more, next_page and data_refreshed_at. A cost row has amount (after discounts, before credits) and list_amount (at list price), so you can see how much caching and batching saved you.

Dimensions, Filters and Limits

You can group by up to five dimensions per request. On the cost endpoint, cost_type and token_type do not count toward the five.

Type Dimensions
Common model, workspace_id, api_key_id, actor, actor_type, service_tier, context_window, inference_geo, speed, product
Enterprise slack_channel_id, claude_tag_category, claude_tag_user_id, rbac_group_id, user_profile_id
Managed Agents agent_id, environment_id, deployment_id, session_id
Cost only cost_type, token_type

Filters use bracket names such as models[], workspace_ids[], api_key_ids[], actor_ids[] and products[]. Each filter takes up to 100 values. Values inside one filter are joined with OR, and different filters are joined with AND. An unknown value simply matches nothing, so check your ids if a report comes back empty.

Other limits: limit is 1 to 1,000 rows per page (default 20), bucket widths are 1m, 1h or 1d, and ending_at is required when you set a bucket width. For more than 31 days, split the range into several requests.

Note: One subtle point: api_key_ids[] matches every request a key authenticated, while actor_ids[] with a key id matches only requests attributed to the key itself. Use the first for “what did this key cost”.

Claude Enterprise: Per-User Spend

For Enterprise, the old user_cost_report becomes a grouped cost query. Filter to users and group by actor and product to see who spends what in Claude, Claude Code and other surfaces.

rows = client.beta.organization.analytics.cost.list(
    starting_at="2026-09-01T00:00:00Z",
    ending_at="2026-10-01T00:00:00Z",
    actor_types=["user_actor"],
    group_by=["actor", "product"],
    limit=100,
)

for row in rows:
    actor = row.group.actor
    if actor is not None and actor.type == "user_actor":
        print(f"{actor.user_id} {row.group.product}: {row.cost.amount}")

For per-user Claude Code cost, Anthropic suggests products[]=claude_code with group_by[]=actor on the cost endpoint. For plan-level Claude Code costs, see my Claude Code pricing guide.

How to Cut Claude API Costs

Tracking only helps if you act on it. Once the cost report shows where money goes, these are the levers that matter most, in rough order of impact.

1. Use the right model

Prices vary a lot. Per million tokens, Claude Haiku 5.5 is $0.10 input and $0.50 output for prompts up to 100K tokens, Sonnet 5.5 is $2 and $10, and Opus 5.5 is $4 and $20.

Group your cost report by model and ask whether each workload really needs the bigger model. Classification, routing and extraction often run fine on Haiku. Full rates are in my Claude API pricing post.

2. Turn on prompt caching

Cache reads cost 0.1x the base input price, and only 0.05x on Opus 5.5 and Sonnet 5.5. A 5-minute cache write costs 1.25x. If you resend a long system prompt, tool list or document, caching can cut input cost by a large margin.

Group cost by token_type to see how much you pay for uncached input. See the prompt caching guide for setup.

3. Use the Batch API for non-urgent work

The Message Batches API gives 50% off input and output. Nightly reports, bulk tagging and evaluations do not need an instant answer.

4. Control output length and effort

Output tokens cost five times more than input on these models. Set a sensible max_tokens, ask for short answers, and use a lower effort setting where deep reasoning is not needed.

5. Watch long-context and region multipliers

Haiku 5.5 jumps to $0.50 input and $2.50 output when a prompt goes over 100K tokens. US-only inference with inference_geo: "us" adds a 1.1x multiplier on newer models. Group by context_window and inference_geo to spot these.

6. Split keys and workspaces per app

One key per app and one workspace per team makes every report readable and lets you set a limit on each. Rotate any key that shows spend you cannot explain. To compare against other vendors, see the AI API pricing comparison.

Moving From the Legacy Usage and Cost API

If you already have a dashboard on the old /usage_report/messages and /cost_report endpoints, most things carry over: the Admin key, time fields, bucket values and bracket syntax. The main changes:

Change Legacy New
Beta header None analytics-usage-cost-2026-08-24
Freshness About 5 minutes 4 to 24 hours
Response shape Time buckets with nested results Flat rows with group
Bucket parameter bucket_width, default 1d time_bucket_width, no default
Actor filter account_ids[], service_account_ids[] actor_ids[], group_by[]=actor
Default workspace workspace_id: null Real wrkspc_ id
Amount format e.g. "123.45" Six decimals plus list_amount
Unknown ids Error Matches nothing

Note the freshness change. If you need near real-time numbers (for example a live dashboard), the legacy API is still supported and much fresher. For billing reports and chargebacks, the new API is better.

Troubleshooting: Common Problems and Fixes

Empty data and data_refreshed_at: null. No data exists yet for that range. Wait a few hours. Data usually lands within 4 hours and can take up to 24.

Numbers change after the month ends. Values can be revised until about 7 days after the end of a calendar month. For final totals, query only months that ended at least 7 days ago.

Cost looks 100 times too high. Amounts are in cents. "41280.000000" is $412.80.

A filter returns nothing. Unknown ids match nothing instead of throwing an error. Check for typos in workspace or key ids.

400 error on the request. Common causes: missing beta header, a range over 31 days, starting_at before 2026-01-01, more than five group_by dimensions, or a bucket width without ending_at.

429 with enforced_spend_limit_reached. Your organization hit its tier cap. Usage pauses until 00:00 UTC on the first of next month unless you get a higher limit. There is no retry-after header, so SDK retries will keep failing. More in fixing Claude 429 and 529 errors.

400 “You have reached your specified API usage limits”. You hit a custom limit you set (or a workspace limit). Raise or remove it on the Billing or Workspaces page to restore access.

Priority Tier shows zero cost. Requests under a Priority Tier commitment show as service_tier: "priority" with zero amount. The commitment fee is billed separately.

Frequently Asked Questions

Is the Claude Usage and Cost Analytics API free?

Anthropic does not list a charge for it. It needs an Admin API key or Enterprise analytics key, and an organization-level rate limit applies.

Can I see spend per API key?

Yes. On Console organizations, group the cost endpoint by api_key_id, or filter with api_key_ids[]. The api_key_id dimension applies only to Console organizations.

Can I see spend per person?

Yes. Group by actor, which identifies a user, service account, federated cloud identity or the API key itself. On Enterprise, add actor_types[]=user_actor to list only users.

How fresh is the data?

It usually refreshes within 4 hours and can take up to 24 hours. Each response includes data_refreshed_at so you know the cutoff.

Can I set a spend limit on a single API key?

The Console offers limits at the organization and workspace level, not per key. Put each key in its own workspace if you need a hard budget per key.

Will the old usage_report endpoints stop working?

Not yet. Anthropic marked them legacy on October 29, 2026, but says they remain supported. Plan a move to the new endpoints for new work.

Can I get an email when spend reaches a set amount?

Yes, per workspace. Open the workspace, click Spend limits, then “+ Add notification” and choose the amount.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Excited woman in orange blazer holding card with Claude logo at a tech conference, text Track every Claude dollar