<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Luke Wilcox</title>
    <description>The latest articles on DEV Community by Luke Wilcox (@luke_wilcox_df999f5e8b442).</description>
    <link>https://dev.to/luke_wilcox_df999f5e8b442</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4230832%2F13ebf527-53b9-402f-aba5-314234ebb5d9.png</url>
      <title>DEV Community: Luke Wilcox</title>
      <link>https://dev.to/luke_wilcox_df999f5e8b442</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/luke_wilcox_df999f5e8b442"/>
    <language>en</language>
    <item>
      <title>Claude API spend by initiative: using Anthropic's Usage and Cost Admin API</title>
      <dc:creator>Luke Wilcox</dc:creator>
      <pubDate>Fri, 06 Nov 2026 16:54:22 +0000</pubDate>
      <link>https://dev.to/luke_wilcox_df999f5e8b442/claude-api-spend-by-initiative-using-anthropics-usage-and-cost-admin-api-40e8</link>
      <guid>https://dev.to/luke_wilcox_df999f5e8b442/claude-api-spend-by-initiative-using-anthropics-usage-and-cost-admin-api-40e8</guid>
      <description>&lt;p&gt;Roiva wrote this, and Roiva reads the API it describes. The facts about Anthropic's reports were gathered from Anthropic's published docs on October 24, 2026, and the beta cost report on October 30, 2026, and each links to the page it came from. Anthropic changes these APIs often, so check the link before you build on a detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you report Claude API spend per AI initiative?
&lt;/h2&gt;

&lt;p&gt;Give each initiative its own workspace in the Claude Console, then read Anthropic's cost report grouped by workspace. Anthropic's bill has no idea which initiative a request served; a workspace is the one dimension its cost report can split by that you control. Anthropic documents workspaces as the way to "separate different projects, environments, or teams while maintaining centralized billing and administration" (&lt;a href="https://platform.claude.com/docs/en/manage-claude/workspaces" rel="noopener noreferrer"&gt;workspaces&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;A workspace is a container inside a Claude Console organization with its own API keys and spend limits. Its costs show up under its own ID in the cost report.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which Anthropic report gives you what?
&lt;/h2&gt;

&lt;p&gt;Anthropic reports Claude spend in six places, and which one you need depends on how your company pays for Claude.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Report&lt;/th&gt;
&lt;th&gt;What it gives&lt;/th&gt;
&lt;th&gt;Grain&lt;/th&gt;
&lt;th&gt;Key or access&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Console &lt;strong&gt;Usage&lt;/strong&gt; page&lt;/td&gt;
&lt;td&gt;Tokens by model, workspace, API key, month or day, with CSV export&lt;/td&gt;
&lt;td&gt;Daily&lt;/td&gt;
&lt;td&gt;Console sign-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Console &lt;strong&gt;Cost&lt;/strong&gt; page&lt;/td&gt;
&lt;td&gt;Dollars by workspace, model and month, with CSV export&lt;/td&gt;
&lt;td&gt;Monthly view&lt;/td&gt;
&lt;td&gt;Console sign-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Usage API, &lt;code&gt;/v1/organizations/usage_report/messages&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Tokens by model, workspace, API key, service tier and more&lt;/td&gt;
&lt;td&gt;1 minute, 1 hour or 1 day&lt;/td&gt;
&lt;td&gt;Admin API key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost API, &lt;code&gt;/v1/organizations/cost_report&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Dollars by workspace and by line description (model, cost type, token type)&lt;/td&gt;
&lt;td&gt;1 day only&lt;/td&gt;
&lt;td&gt;Admin API key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Usage and Cost Analytics API (beta), &lt;code&gt;/v1/organizations/analytics/cost&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Dollars by API key, workspace, model and more&lt;/td&gt;
&lt;td&gt;1 day, or the whole range&lt;/td&gt;
&lt;td&gt;Admin API key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code Analytics API, &lt;code&gt;/v1/organizations/usage_report/claude_code&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;One record per user per day: sessions, lines, commits, accepted edits, estimated cost&lt;/td&gt;
&lt;td&gt;1 day&lt;/td&gt;
&lt;td&gt;Admin API key&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Sources: &lt;a href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api" rel="noopener noreferrer"&gt;Usage and Cost API&lt;/a&gt;,&lt;a href="https://support.claude.com/en/articles/9534590-cost-and-usage-reporting-in-the-claude-console" rel="noopener noreferrer"&gt;Console reporting&lt;/a&gt;, &lt;a href="https://platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api" rel="noopener noreferrer"&gt;Usage and Cost Analytics API&lt;/a&gt;, &lt;a href="https://platform.claude.com/docs/en/manage-claude/claude-code-analytics-api" rel="noopener noreferrer"&gt;Claude Code Analytics API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Claude Enterprise organizations on claude.ai are separate. They don't appear in the Claude Console, carry no Admin API keys, and report through the Claude Enterprise Analytics API with an Analytics API key instead (&lt;a href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api#which-api-do-you-need" rel="noopener noreferrer"&gt;which API do you need?&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the Usage and Cost Admin API need?
&lt;/h2&gt;

&lt;p&gt;An Admin API key, which starts &lt;code&gt;sk-ant-admin01-&lt;/code&gt; and which only organization members with the admin role can create. Anthropic also accepts an OAuth token with the &lt;code&gt;org:admin&lt;/code&gt; scope, or a personal or service account key that isn't scoped to a workspace; "workspace API keys don't work" (&lt;a href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api" rel="noopener noreferrer"&gt;Usage and Cost API&lt;/a&gt;). The Admin API isn't available to individual accounts, so set up an organization first.&lt;/p&gt;

&lt;p&gt;What else to know before you build on it, as Anthropic documents it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Money is in cents.&lt;/strong&gt; "All costs are in USD, reported as decimal strings in lowest units (cents)."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The cost report is daily only&lt;/strong&gt;, up to 31 days a request, grouped by &lt;code&gt;workspace_id&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt;. Grouping by description adds the model, the cost type (tokens, web search, code execution) and the token type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The default workspace has no ID.&lt;/strong&gt; Its usage and costs carry a &lt;code&gt;null&lt;/code&gt; &lt;code&gt;workspace_id&lt;/code&gt;, so a script that drops nulls drops the default workspace. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data is near real time.&lt;/strong&gt; It "typically appears within 5 minutes," and Anthropic supports polling once a minute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pagination&lt;/strong&gt; uses &lt;code&gt;has_more&lt;/code&gt; and &lt;code&gt;next_page&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Can you see Claude API spend by user?
&lt;/h2&gt;

&lt;p&gt;Not for requests made with API keys. Anthropic's support article says "currently, it's not possible to break down usage or cost by individual users" in the Console (&lt;a href="https://support.claude.com/en/articles/9534590-cost-and-usage-reporting-in-the-claude-console" rel="noopener noreferrer"&gt;Console reporting&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The Usage API can group by the account behind a request only where the request was signed in as a person rather than made with an API key, and the cost report has no user dimension at all.&lt;/p&gt;

&lt;p&gt;For Claude Code, the Claude Code Analytics API gives per-user, per-day activity with an estimated cost. For an application your team built, log the user, the task and the engagement or customer in the application itself, and use workspaces or API keys to split the bill.&lt;/p&gt;

&lt;h2&gt;
  
  
  What isn't in Anthropic's cost report?
&lt;/h2&gt;

&lt;p&gt;Several kinds of Claude spend never reach it, and a total built only from it will be short by exactly those:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Spend&lt;/th&gt;
&lt;th&gt;Where it shows instead&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Priority Tier&lt;/td&gt;
&lt;td&gt;Not in the cost endpoint: "Priority Tier costs use a different billing model." Anthropic says to track Priority Tier usage through the usage endpoint (&lt;a href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api" rel="noopener noreferrer"&gt;Usage and Cost API&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude on Amazon Bedrock&lt;/td&gt;
&lt;td&gt;Your AWS bill; Anthropic lists its Admin and Usage and Cost endpoints among the features Bedrock doesn't support (&lt;a href="https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy#features-not-supported" rel="noopener noreferrer"&gt;Claude on Amazon Bedrock&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude on Google Cloud&lt;/td&gt;
&lt;td&gt;Your Google Cloud bill. For the Anthropic-managed offering, only the usage endpoint works and cost shows on the Console Cost page (&lt;a href="https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview" rel="noopener noreferrer"&gt;Google Cloud&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Team and Enterprise seats&lt;/td&gt;
&lt;td&gt;Your invoice from Anthropic, and the claude.ai analytics for Team and Enterprise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Platform on AWS&lt;/td&gt;
&lt;td&gt;The Console Usage and Cost pages; the API endpoints aren't available there&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How do you split one Claude bill across initiatives?
&lt;/h2&gt;

&lt;p&gt;Claim what you can by workspace, and split only what's left. A method a finance team can audit:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One workspace per initiative&lt;/strong&gt;, created before the initiative goes live, with its own API keys. Spend that lands in the right workspace needs no
allocation at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decide the default workspace's fate.&lt;/strong&gt; Either keep it empty or treat it
as shared. Anthropic doesn't let you set a spend limit on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split out a shared workspace's keys.&lt;/strong&gt; Anthropic's beta cost report gives
dollars by API key, so a key that serves one initiative can be claimed alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split the rest by a stated weight&lt;/strong&gt;, such as requests or seats by
team, and write the weight down before the month closes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Book the API cost once.&lt;/strong&gt; The Anthropic invoice in your ERP is the same
money as the cost report. Use one as the source for each month, not both.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add what the report misses.&lt;/strong&gt; Priority Tier, Bedrock and Google Cloud
spend come from their own bills.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch unit cost, not just spend.&lt;/strong&gt; Cost per million output tokens, by
model and month, says whether a cheaper model or better caching made each
answer cheaper, separately from how much the initiative was used.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How does Roiva book Claude API spend to initiatives?
&lt;/h2&gt;

&lt;p&gt;Roiva does the routine above every night, from the same reports.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It reads the cost and usage reports.&lt;/strong&gt; Connect Anthropic with an Admin API
key and Roiva reads the cost report by workspace and line description, and
the usage report by model and workspace, for the last 12 months, then every
night after. It never reads a prompt or a response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workspaces become initiatives.&lt;/strong&gt; When you link the connection to an
initiative, Roiva asks how much of the bill is the initiative's: all of it,
only some workspaces, each booked whole, or a share of every charge. What
no initiative takes stays unattributed rather than being spread silently. A
changed share applies from the first of that month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An API key can stand alone.&lt;/strong&gt; An initiative can claim one key and book what
Anthropic's beta report says that key cost. The rest of its workspace books
as if the key weren't claimed, and a day whose key figures don't add up to
the workspace's bill stays with the workspace.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The invoice isn't counted twice.&lt;/strong&gt; In any month the connection books, an
Anthropic invoice mapped to the same initiative in QuickBooks, Xero or
NetSuite is left out, unless an allocation rule or a locked month keeps the
invoice instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unit cost, with the cause.&lt;/strong&gt; Roiva tracks cost per million output tokens
by model and month. Where an initiative books a saving on that unit cost,
Roiva splits the saving into what Anthropic's price changes gave and what
your own choices earned: the models you ran, what you cached and how you
shaped the work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code and Claude Enterprise.&lt;/strong&gt; The same key reads Claude Code's
daily totals, with user names dropped before anything is saved. Claude
Enterprise seats need their own connection with an Analytics API key, which
also books usage cost by user group or estimated chat Project.
Claude on Bedrock is booked from the AWS connection, by tag or by service,
and on Google Cloud from the Google Cloud connection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Roiva books from Anthropic's cost report, so Priority Tier spend, which isn't in that report, has to reach the initiative as a cost you enter. The &lt;a href="https://roiva.ai/integrations/anthropic" rel="noopener noreferrer"&gt;Anthropic integration page&lt;/a&gt; shows a worked month, and &lt;a href="https://roiva.ai/docs/how-costs-reach-an-initiative" rel="noopener noreferrer"&gt;How costs reach an initiative&lt;/a&gt; covers every way spend becomes an initiative's cost and where the same dollar can arrive twice.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>finops</category>
      <category>api</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
