◉CLAUDE LABJP
●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through
Articles/API & SDK
⬡ API & SDK/2026-07-07Advanced

Four sites, one Claude bill: attributing spend per workspace to decide which pipeline to trim

When several projects share one Claude organization, the bill arrives as a single number that hides which pipeline is expensive. Field notes on splitting that spend per workspace with the Cost and Usage Report group_by, defensively parsing the results, and deciding what to trim by cost-effectiveness.

Claude API150Cost ReportUsage APIcost allocationworkspaceindie dev11

✦ Premium Article

One morning at the start of the month I opened Claude's cost page and paused. Spend was clearly up from the previous month. But whether that increase came from claudelab, from gemilab's overnight batch, or from somewhere else — I had no way to tell.

As an indie developer, I run four technical blogs on my own, and I route their article generation, summarization, and link-checking through a single Claude organization. Convenient, but the cost comes back as one merged bill. I could see the total hovering around $4 a day; I could not see which site's which job was eating it. And without that, there is no way to know where a cut would actually help.

This article walks through splitting the Cost Report and Usage Report by workspace so a merged bill can be attributed back to each site. The basics of the two endpoints live in "Monitoring Claude API cost programmatically with the Usage & Cost API"; here I focus one level deeper, on the allocation — the showback.

Why a merged bill dulls your judgment

A single number hides problems inside its average.

At four sites totaling $4 a day, the intuitive read is "about $1 per site." When I actually divided it, one site accounted for roughly 48% of the total and the other three split the remaining 52%. The growth lived in one specific pipeline. Had I kept staring at the total, I would have chased a pointless optimization — shaving a little off everything, evenly and uselessly.

There is a second trap: the imbalance in cache creation tokens. One site rewrites the front of its prompt so often that caching barely helps, and cache creation made up a large share of its input tokens. That is completely buried in a merged view. Where a fix will pay off only becomes visible after you divide.

A self-maintained token ledger (the approach in "accounting the four usage buckets correctly") can allocate too, but it drifts quietly from the invoice through missed records and mishandled failed requests. Starting from the authoritative Cost Report gives you a correct total to build on first.

Two axes for splitting spend: workspace and API key

Anthropic's administrative endpoints offer two ways to slice spend.

AxisCost ReportUsage ReportWhere it fits for solo ops
WorkspaceYesYesOne workspace per site. Clean boundary — my recommendation
API keyNoYesIf you run one key per site. Note: revoked keys still appear as rows
ModelEffectively oneYesSee the Opus 4.8 / Sonnet 5 / Haiku split to find downgrade room
Service tierYesYesUnderstand the price gap between batch and standard

I settled on one workspace per site. Keys are easy, but rotating a key gives its past and present rows different IDs and breaks the continuity of your aggregation. Workspaces are long-lived, and once you build a workspace_id → site name map it keeps serving you.

Note that the Cost Report is daily (1d) granularity only. When you want a finer waveform, pull the Usage Report at bucket_width=1h and multiply by unit prices to approximate. In practice: the Cost Report for the exact billed amount, the Usage Report for resolution on the breakdown.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Pulling Cost Report and Usage Report with group_by=workspace to split one org bill back into per-site spend
✦Defensive parsing that survives changing fields, plus a day-by-site showback pivot you can read at a glance
✦A cost-per-click and cache-creation-ratio lens for choosing which pipeline to actually trim
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ API & SDK2026-05-15
Automating Wallpaper Classification with Claude Vision API — Accuracy, Cost, and a Batch Job That Survives Interruptions
A firsthand account of automating wallpaper category classification with the Claude Vision API. Honest numbers on accuracy and cost, plus the batch design that stopped me re-paying for the same images.
⬡ API & SDK2026-05-12
Combining Haiku 4.5, Streaming, and Prompt Caching to Cut Costs in a Personal App — An Implementation Record
A hands-on record of combining Claude Haiku 4.5, streaming, and prompt caching to improve both cost and response speed in a personal iOS/Android app — including the mistakes made along the way.
⬡ API & SDK2026-11-30
The unit price drops 20%, yet the bill may rise: estimating the Opus 4.5 to 5.5 switch before January 22
claude-opus-4-5-20251101 retires on January 22, 2027, and the official replacement is claude-opus-5-5. Prices fall by a fifth, but the tokenizer changes and thinking can no longer be turned off. You will be able to count the cost per 1,000 of your own requests and pick a replacement and an effort level.