Claude API costs: a new API shows who spends tokens and on what
Claude API costs can now be broken down by model, API key, user and product, such as Claude Code. Here's what the new Usage and Cost Analytics API offers.
This article in other languages:العربيةDeutschEspañolFrançaisItaliano日本語Polski简体中文
In this article
On October 29, Anthropic released the Usage and Cost Analytics API in beta, a new API for reporting token usage and Claude API costs across an organization. According to the Claude Release Notes, the existing Usage and Cost API becomes a “legacy” API as of that day, although it’s still supported.
What’s new in Claude API cost reporting?
The API has two endpoints:
GET /v1/organizations/analytics/usagereturns token and request counts,GET /v1/organizations/analytics/costreturns cost in USD.
The most interesting part is how we can slice this data. In a single request, we group results by up to five dimensions: model, workspace, API key, service tier, context window, inference region, product, and the so-called “actor”, meaning whoever actually sent the request. An actor can be a user, a service account, an AWS or Google Cloud identity, or, if there’s none of those, the API key itself.
Results come back as a ranking, sorted by highest usage by default. So the question “which API keys spent the most this month?” is a single request, not a script stitching together data from several reports.
There’s a ready-made recipe for Claude Code: cost per user comes from a request with products[]=claude_code&group_by[]=actor. After measurements showing that hidden agent summaries eat up 16–22% of session costs, that’s very timely.
What does a request look like?
An example from the documentation: daily token usage for the first week of September, broken down by model.
curl --globoff "https://api.anthropic.com/v1/organizations/analytics/usage?\
starting_at=2026-09-01T00:00:00Z&\
ending_at=2026-09-08T00:00:00Z&\
time_bucket_width=1d&\
group_by[]=model&\
limit=10" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: analytics-usage-cost-2026-08-24" \
-H "x-api-key: $ANTHROPIC_API_KEY"
Each row has three parts: the time range, group with the dimensions, and usage (or cost) with the numbers. In usage you’ll find, among other things, uncached input tokens, tokens written to and read from the cache, output tokens, the number of web searches and the number of requests. The same is available through the SDK and the ant CLI (ant beta:organization:analytics:usage list).
A few details:
- Time buckets are 1 minute, 1 hour or 1 day, all in UTC.
- A single request covers up to 31 days, and only 24 hours with minute buckets.
- Data goes back to January 1, 2026, and at most 365 days.
- A results page has from 1 to 1000 rows (20 by default).
What does the cost endpoint show?
The /cost endpoint returns two amounts: amount, the cost after discounts but before credits are applied, and list_amount, the cost at list prices. Amounts are given in cents with six decimal places, so "41280.000000" means $412.80.
Two extra dimensions, cost_type and token_type, break the cost down into tokens of each type, web search, code execution and sessions. They don’t count toward the five-dimension limit.
What to watch out for?
First, latency. Data refreshes usually within 4 hours, sometimes up to 24 hours, whereas in the old Usage and Cost API it usually appeared within 5 minutes. For “right now” alerts, you’d better look for something else.
Second, adjustments. Values can still change for about 7 days after the end of a calendar month, so we’ll get the final October totals around November 7.
Third, Priority Tier. Requests made under a purchased Priority Tier show up in usage, but their token cost is zero, because the commitment fee is billed separately.
Fourth, access. The API works only for organizations: in the Claude Console with an Admin API key, and in Claude Enterprise with a key that has the read:analytics scope. Individual accounts can’t use it. It also works on Claude Platform on AWS and in Claude Models on Google Cloud, with that cloud’s authentication.
Is this anything new in the AI world?
Cost reports in the Claude Console existed before. What’s new is that the same endpoints and fields serve both Claude Console organizations and Claude Enterprise. For Enterprise, it’s also the end of a limit: the old reports returned only the top 100 groups in each bucket, the new ones return all of them.
It’s another step by Anthropic toward spending control, right after Claude smart reports, which show what a team did with Claude and how much it cost.
FAQ
How do I check Claude API costs?
In the Claude Console on the Usage and Cost pages, or programmatically through the Usage and Cost Analytics API (the /v1/organizations/analytics/cost endpoint) with an Admin API key. Each individual API response also includes a usage block with the token count for that request.
Will the old Usage and Cost API stop working?
As of October 29, no. According to the Claude Release Notes, it has “legacy” status but is still supported, and the documentation includes a migration guide.
How do I check how much each Claude Code user spends?
With the cost endpoint and the parameters products[]=claude_code&group_by[]=actor. Claude Console organizations can also use the separate Claude Code Analytics API.