Skip to content

Connecting Anthropic to CostReveal, setup guide

The CostReveal team, , 7 minute read

Claude API spend tends to arrive as one total: tokens in, tokens out, amount due. Which team, product or customer those tokens were for is not on the invoice. This guide covers how CostReveal reads Anthropic's cost report with an Admin API key, what that key can and cannot be limited to, how workspace owners and tags explain spend by team, feature and customer, how usage data divides spend that many customers share, and how each month is checked against Anthropic's own total.

What the Anthropic connection reads

CostReveal reads what Anthropic bills from your organization's cost report, the same figures as the Cost page in the Claude Console. Nothing changes in the code that calls Claude, and nothing sits between your application and the API.

Each line CostReveal records is a day, a workspace and one line item, by model, token type, service tier, context window and inference region. Token costs are billed per model. Web search and code execution fees are not, so they appear without a model; usage data that reports each call's searches and code executions divides them as well.

If you call Claude through Amazon Bedrock or Google Cloud's Vertex AI instead, that spend is on your cloud bill, not in Anthropic's cost report, and it arrives through your AWS or Google Cloud connection.

What you need

  • An Anthropic organization in the Claude Console. The Admin API is not available to individual accounts.
  • An organization admin, who can create Admin API keys.
  • An owner or admin role in CostReveal.

Step by step setup

1. Create an Admin API key

In the Claude Console, go to Settings, Admin keys and create a key. Name it for CostReveal, so it can be revoked on its own without affecting anything else.

2. Start the connection

In CostReveal, go to Connections and choose Connect Anthropic.

3. Verify and connect

Paste the key and choose Verify and connect. Only the key's format is checked as you type. When you verify, CostReveal reads your organization, its workspaces and its cost report with the key before saving anything, and says exactly what is wrong if it cannot.

Anthropic reports usage and cost within minutes, and CostReveal reads it every hour. The first read brings in the current month and the twelve before it, as far as Anthropic holds them. Where Anthropic holds no older months, Connections says how far back it reached, and each read asks again. After that, each read covers the current and the previous month.

What an Admin API key can do

Anthropic admin keys cannot be limited to reading. A key could also manage your organization's members, workspaces and API keys. That is how Anthropic's Admin API works today, and it is worth knowing before a security review asks.

What CostReveal does with it is narrower: it only ever reads usage and cost. The key is encrypted at rest, is never shown again after you enter it, and is deleted when you remove the connection. You can revoke it in the Claude Console at any time; CostReveal then keeps every figure already read and tells you new data has stopped. To rotate it, create a new key and enter it in the connection, where it replaces the one in use.

Connection states

Under Connections, the connection is always in one of four states:

  • Setup not finished: no key has been verified yet.
  • Waiting for first data: the key was verified, and the first read has started.
  • Connected: the cost report has been read and the latest read succeeded.
  • Needs attention: the latest read failed, for example because the key was revoked. Everything already read is kept.

How Claude spend is explained

Service and model are direct

The service and the model come from Anthropic itself, so they carry the DIRECT basis. Explore can show spend by model across the Claude family, and a new model appears as soon as Anthropic bills it, with no configuration. Coverage by model is measured against spend billed per model, so cloud spend in the same project never dilutes it.

Team, feature and customer come from workspaces

Anthropic bills by workspace, so workspaces are where ownership starts. For each workspace, CostReveal looks in this order:

  1. An owner you name for the workspace under Connections, Workspace owners, for team, feature or customer.
  2. The workspace's own tags in the Claude Console, read with the project's tag keys, the same ones used for AWS resource tags.
  3. Otherwise the spend is UNKNOWN, shown as such and never spread across teams.

Spend explained either way carries the INFERRED basis: someone, you or a tag, said who the workspace belongs to. A workspace's name is never read as its owner. A workspace called payments explains nothing until you name its owner or tag it.

Naming an owner, renaming a workspace, or changing its tags explains every past period again. The billed figures themselves never change; only who they are attributed to does.

Usage data divides shared spend by customer

Workspaces work well for teams. They rarely work for customers, because many customers share one workspace and one API key. Only your application knows which customer a call was for, so CostReveal accepts usage data: a record of each call, with its model, tokens and who it was for.

  • Create a key under Settings, API keys with the scope Send data only. It can send usage data to its project and read nothing.
  • Point an OpenTelemetry exporter that emits GenAI spans at the endpoint shown in Connections, or turn on LiteLLM's OpenTelemetry callback. Without OpenTelemetry, send events to the usage events endpoint, up to 1,000 per request.
  • Name the customer, feature, user or team as span attributes or event fields. Send identifiers, never email addresses. No prompt or response content is read.

CostReveal then divides the billed cost in proportion to what each owner used, and marks it ALLOCATED. Usage data never adds a cent: totals stay exactly what Anthropic billed. It divides only what workspace owners and tags leave unknown, and only what it covers. If your data reports 60 percent of the tokens a model was billed for, 60 percent of that model's unexplained cost is divided, and the rest stays Not yet explained. Anthropic is the provider usage data divides today.

Allocation rules for the rest

An allocation rule can name an owner for lines that match conditions such as the account, model or a tag (INFERRED), or share what is still unknown at fixed percentages, evenly or by explained spend (ALLOCATED). Workspace owners and tags always come first.

How the figures are checked

  • The ledger is append only. Every line is recorded as Anthropic reported it. A day Anthropic restates is recorded as a correction, and what it said before is kept. Reading the same data again records nothing new.
  • Attribution adds up. On every dimension, what is attributed must add up exactly to the ledger.
  • A second source. Each month's detailed lines must add up to the organization's total for the month from Anthropic's cost report, read separately. While a month is open, a difference is shown as pending; once the month has closed, it is flagged.

One limit to know: Priority Tier costs are billed differently and are not in Anthropic's cost report, so they are not included.

Getting the most out of attribution

  • One workspace per team or product. Everything in the default workspace leaves CostReveal with nothing to go on. Separate workspaces give each team its own figures.
  • Name owners in CostReveal, or tag workspaces. Either works; a named owner wins over tags. Home's next best action suggests naming the team for the Anthropic workspace that would explain the most, with its share of the period's total spend.
  • Send usage data for customer level figures. Where one workspace serves many customers, usage data is the only source that can say which customer each call was for. Home suggests it once no single naming or tagging step would explain more.
  • Separate production from experiments. A workspace for each keeps exploratory spend from hiding in production figures, and gives each its own trend, forecast and anomalies in Insights.

Once spend is explained, budgets can alert the team that owns a workspace's spend, and chargeback can bill it to their cost center.

Frequently asked questions

Why does CostReveal need an Admin API key instead of a regular API key? Only admin keys can read an organization's cost report. Regular API keys make calls; they cannot see what anything cost.

Can the Admin API key be limited to read only? No. Anthropic does not offer a read scoped admin key, so a key could also manage members, workspaces and API keys. CostReveal only reads usage and cost with it, encrypts it at rest, and deletes it when you remove the connection.

How much history does CostReveal read? The first read brings in the current month and the twelve before it, as far as Anthropic holds them. Where Anthropic holds no older months, Connections says how far back it reached, and each read asks again. After that, each hourly read covers the current and previous month.

Does naming a workspace explain its spend? No. Names are never read as owners. Name the workspace's owner under Connections, Workspace owners, or tag the workspace in the Claude Console, and every past period is explained again.

How do I attribute Claude spend to individual customers? Send usage data with the customer on each call, through OpenTelemetry or the usage events endpoint. CostReveal divides the billed cost by each customer's share of the tokens and marks it ALLOCATED.

Are Priority Tier costs included? No. They are billed differently and are not in Anthropic's cost report, so CostReveal cannot read them.

We use Claude through Bedrock or Vertex AI. Does this connection cover it? No. That spend is on your AWS or Google Cloud bill. Connect that provider instead.

Keep reading