Skip to main content
FinOps

Attributing Anthropic API Spend to Teams: Workspaces, Keys, Admin API

Anthropic gives you workspaces, API keys and three reporting APIs to split a Claude bill. What each can attribute, what shows up as null, and a setup that gives finance a number per team.

10 min read

Anthropic spend usually becomes an attribution problem around the third team. The first product team created a key in the Default Workspace. A second team asked for its own key. Someone built an internal tool on a third. Now finance has one Claude invoice and wants to know how much of it belongs to each product, and nobody planned for that question.

Anthropic does give you what you need to answer it. Workspaces, API keys and the Admin API reporting endpoints can split a bill cleanly. Each one has limits, though, and the limits only show up after you have structured your org around them. This post covers what each one can attribute, what comes back as null, and a setup that gives you a number per team without guesswork.

The three levels you can split by

The Claude Console has an org at the top, workspaces inside it, and API keys inside workspaces. On top of that, the newer reporting API adds an "actor" dimension: the person or service account behind a request.

What matters for cost attribution is which of these levels each report can group by. They don't all support the same ones, and that difference decides your design.

Workspaces: the boundary that reaches every cost report

A workspace is the level that every Anthropic cost report can group by, and it's the one you control directly. When you create additional workspaces, you can assign members, service accounts, API keys, and resource limits to each one.

A few properties matter for attribution:

  • Keys can't move. API keys are tied to the Workspace they're created in and cannot be moved between Workspaces. If a key was created in the wrong workspace, you have to rotate it into the right one. You can't reassign it.
  • Spend limits are per workspace. To set one, go to platform.claude.com/settings/workspaces, select the workspace. In the panel that opens, click Spend limits. Setting limits through the API is still restricted: for Console organizations, setting those limits is in an early access preview. To request access, contact your Anthropic account team.
  • The Default Workspace is a weak spot. You can't set a spend limit for the default Workspace, and in the legacy reports the legacy Usage and Cost API reports show null for workspace_id for it. If production traffic runs there, your top cost line will be null.
  • Claude Code gets its own workspace. Anthropic creates the Claude Code workspace automatically the first time a member of your organization signs in to Claude Code with their Console account. It isolates Claude Code's API keys, usage, and rate limits from your other workloads. Developer tooling spend therefore stays separate from product spend without any extra work.
  • There is a ceiling. According to one third-party hardening guide, Anthropic allows up to 100 workspaces per organization (archived workspaces do not count). That's plenty for teams and products. It isn't enough for one workspace per customer.

There is also a cost trade-off that teams rarely notice when they split things up: prompt caches are also isolated by workspace on the Claude API, Claude Platform on AWS, and Microsoft Foundry. Suppose two services share a large cached system prompt and you move them into separate workspaces. Each one now pays its own cache writes and stops reading the other's cache. On Sonnet 5.5 a 5-minute cache write costs $2.50 per million tokens and a cache read costs $0.10, so a cache that is duplicated and rarely read adds real cost. Split by ownership, but keep services that share a prefix in the same workspace.

API keys: finer grain, but not in every report

Inside a workspace, the API key is the natural unit for "which service made this call". Most teams already run one key per service or environment. The catch is that the legacy cost report doesn't support keys. More on that below.

One gap to know about: API usage from playground in the Claude Console (and from the legacy Anthropic Workbench before it) is not associated with an API key, so api_key_id is null even when grouping by that dimension. Prompt experiments in the Console therefore show up as unattributed usage.

The reporting endpoints, and what each can group by

All of these endpoints sit under the Admin API. You can access them using an Admin API key, an OAuth token with the org:admin scope, or a personal or service account key that isn't scoped to a workspace; workspace API keys don't work. Admin keys start with sk-ant-admin01-, and only org admins can create them.

Legacy Usage API: GET /v1/organizations/usage_report/messages

This endpoint returns token counts, not dollars. It's flexible:

  • Aggregate usage data in fixed intervals (1m, 1h, or 1d).
  • Measure uncached input, cached input, cache creation, and output tokens.
  • Filter by API key, workspace, model, service tier, context window, data residency, or speed, and group results by these dimensions.

A per-key, per-model daily pull looks like this:

bash curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-10-01T00:00:00Z&\ ending_at=2026-11-01T00:00:00Z&\ group_by[]=api_key_id&\ group_by[]=model&\ bucket_width=1d" \ -H "anthropic-version: 2026-10-21" \ -H "x-api-key: $ANTHROPIC_ADMIN_KEY"

Legacy Cost API: GET /v1/organizations/cost_report

This endpoint returns dollars, but with fewer dimensions. group_by: optional array of "description" or "workspace_id" are the only grouping options, and buckets are daily. All costs are in USD, reported as decimal strings in lowest units (cents). Your parser must divide by 100. If it doesn't, your dashboard will show 100 times the real spend. Track token usage, web search, and code execution costs.

The missing dimension is the API key. A public feature request sums it up: cost can be attributed to a workspace, but not to an individual API key within it.

Usage and Cost Analytics API (beta): /v1/organizations/analytics/usage and /v1/organizations/analytics/cost

This is the newer API, and it closes most of the gap. The Usage and Cost Analytics API is in beta. Send the anthropic-beta: analytics-usage-cost-2026-08-24 header and an anthropic-version header on every request. Anthropic's own docs now point you at it for per-key cost: For cost by API key, group by api_key_id instead.

It also adds the actor dimension. On the usage endpoint you can filter to usage attributed to specific identities, by tagged ID: a user_..., svac_... (service account), or apikey_... ID. Requests from Claude Managed Agents get a separate dimension: use group_by[]=agent_id to break out per-agent values.

It also fixes the Default Workspace problem: the Usage and Cost Analytics API reports its usage and cost under its real ID.

bash 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[]=workspace_id&\ group_by[]=api_key_id" \ -H "anthropic-version: 2026-10-21" \ -H "anthropic-beta: analytics-usage-cost-2026-08-24" \ -H "x-api-key: $ANTHROPIC_ADMIN_KEY"

It's still a beta, so expect the schema to change. If you build chargeback on it, keep the legacy workspace-level cost report running next to it so you have a stable figure to check against.

Worked example: Northwind Labs

Northwind Labs runs three Claude workloads on Sonnet 5.5, all with keys in the Default Workspace:

  • support-bot, a customer support assistant with a large cached system prompt
  • doc-search, a retrieval feature that sends long, uncached context
  • internal-tools, a set of scripts used by the ops team

Finance pulls the legacy cost report grouped by workspace_id for October and gets one row with workspace_id: null. That tells them the total and nothing else.

The platform team then pulls the legacy usage report grouped by api_key_id and prices it themselves. As of November 2026, Sonnet 5.5 is $2/ MTok for input and $10/MTok for output on Anthropic's model page, and a cache hit costs 5 percent of the standard input price ($0.20 USD per million tokens on Claude Opus 5.5, $0.10 USD on Claude Sonnet 5.5).

  • `support-bot`: Uncached input: 400 MTok × $2 = $800; Cache reads: 900 MTok × $0.10 = $90; Output: 40 MTok × $10 = $400; Estimated cost: $1,290
  • `doc-search`: Uncached input: 1,200 MTok × $2 = $2,400; Cache reads: 0; Output: 30 MTok × $10 = $300; Estimated cost: $2,700
  • `internal-tools`: Uncached input: 150 MTok × $2 = $300; Cache reads: 0; Output: 15 MTok × $10 = $150; Estimated cost: $450
  • Total: Estimated cost: $4,440

This is a useful first cut. doc-search is about 60.8% of the estimated total ($2,700 / $4,440), and it's an obvious candidate for caching or the Batch API. But it is list-price arithmetic on tokens. It leaves out cache writes, web search and code execution charges, batch discounts and anything else that isn't a plain input or output token. If Northwind's billed total for October were $4,512, the $72 gap would belong to no one in this table.

The fix happens in two steps:

  1. Restructure. Create support, search and ops workspaces. Issue new keys in each, deploy them, and revoke the old Default Workspace keys. support-bot doesn't share a cached prefix with the other two, so splitting it costs nothing in cache efficiency.
  2. Report on billed cost. Pull the analytics cost endpoint grouped by workspace_id and api_key_id. Every dollar now comes from Anthropic's own billing data, and line items like web search land on the workspace that triggered them.

After the change, the legacy cost report also has three non-null rows. That gives finance a stable, non-beta figure for each team, and the beta endpoint supplies the per-key detail.

What you still can't see

Even with a clean setup, some things stay out of reach:

  • Per-key dollars in the legacy cost report. You have to use the beta Analytics API or estimate from tokens.
  • Any free-form label. None of the documented group-by dimensions is a tag you set per request. "Cost per customer" or "cost per feature flag" needs either one key per feature or your own logging of the usage block on each response.
  • Per-user cost for plain API-key traffic. The actor dimension covers requests made by people or service accounts. A shared service key in production is just a key.
  • Playground usage by key. It comes back as null.
  • Claude through other clouds. Anthropic's pricing page sends you elsewhere for Bedrock and Google-managed Vertex: for official pricing on Claude Models on Google Cloud (Google managed) and Amazon Bedrock, you go to those providers. That spend appears on your AWS or Google Cloud bill, not in the Admin API. For the Anthropic-managed Google Cloud offering, of the Usage and Cost API endpoints, only the usage endpoint is available.
  • Shared-cache fairness. If two teams share a workspace to share a cache, the cache savings land on whichever key reads the cache. You will need an allocation rule for that.

A setup that holds up

  • One workspace per owning team or product, split by environment only where you need separate spend limits for prod and non-prod.
  • One key per service inside each workspace, with a naming convention that includes the owner. Use the List API Keys endpoint to keep a key ID to owner map, because the reports return IDs, not names.
  • Nothing in the Default Workspace. It can't take a spend limit, and the legacy reports show it as null.
  • A spend limit on every workspace, so a runaway job in one product can't use up the org's monthly budget.
  • Daily pulls from both cost endpoints. Use the legacy report as the stable figure per workspace and the Analytics API for per-key and per-actor detail. Check the sum against the invoice every month.

If Anthropic is one of several AI and cloud bills you are reconciling, CloudYali connects to Anthropic with an Admin API key and calls only read endpoints. It shows Anthropic spend in Cost Explorer next to AWS, Azure, Google Cloud, OpenAI and Cursor, and lists Anthropic resources in Resource Inventory. Billing data is collected once a day, so use it for daily and monthly review, not for live alerting. The Track AI and LLM spend guide walks through the setup, and CloudYali Cost Anomalies flags a day when Anthropic spend jumps well above its own 30-day baseline.

The short version

  • Workspaces are the only boundary every Anthropic cost report can group by. Put each team or product in its own workspace and keep the Default Workspace empty.
  • The legacy cost_report groups by workspace_id and description only. For dollars per API key or per user, use the beta Usage and Cost Analytics API (/v1/organizations/analytics/cost).
  • Cost amounts are decimal strings in cents. Divide by 100.
  • Prompt caches are isolated per workspace, so keep services that share a cached prefix together.
  • Bedrock and Google-managed Vertex spend on Claude doesn't appear in the Admin API. Attribute it from those cloud bills.

Frequently asked questions

Give each team or product its own workspace in the Claude Console, create its API keys inside that workspace, then query the Admin API cost endpoint grouped by workspace_id. Both the legacy cost report (/v1/organizations/cost_report) and the beta Usage and Cost Analytics API (/v1/organizations/analytics/cost) support grouping by workspace. Keep production traffic out of the Default Workspace, because the legacy reports show its workspace_id as null.

Yes, with the Usage and Cost Analytics API, which launched in beta on October 29, 2026. Its cost endpoint accepts group_by[]=api_key_id and needs the anthropic-beta: analytics-usage-cost-2026-08-24 header. The legacy cost report only groups by workspace_id and description, so with that endpoint you can only estimate per-key cost from token counts and list prices.

You need an Admin API credential, typically an Admin API key starting with sk-ant-admin01. An OAuth token with the org:admin scope also works, as does a personal or service account key that isn't scoped to a workspace. Regular workspace API keys are rejected by these endpoints.

A null workspace_id in the legacy Usage and Cost API means the usage came from the Default Workspace. The newer Analytics API reports the Default Workspace under its real ID instead. A null api_key_id means the request didn't come through an API key, for example usage from the Console playground.

Not in Anthropic's reports. The usage and cost endpoints group by fixed dimensions such as workspace, API key, model, service tier and actor, and none of them is a free-form label you set per request. If you need attribution by feature or customer, use a separate key or workspace per feature, or log token usage from each response in your own application.

  • #Anthropic
  • #Claude API
  • #Cost Attribution
  • #FinOps
  • #AI Cost Management
  • #Showback

Related reading

More on FinOps