CLAUDE LABJP
OUTPUT — v2.1.237 ships a built-in Concise output style that leads with results and skips preamble, without cutting any corners on the work itself. Pick it under Output style in /configCACHE — v2.1.237 fixes prompt caching for sessions running through an LLM gateway or a custom base URL. If you work behind a company proxy, your effective per-token cost just changedCONFIG — v2.1.236 adds ANTHROPIC_DEFAULT_MODEL to set which model new sessions start on. A /model pick still overrides it and persists across restarts, unlike ANTHROPIC_MODELNOTIFY — With notify_when_idle in v2.1.236, one Claude Code session can ask another on the same machine for a single heads-up when it next goes idle. Opt-in, one-shot, no pollingSECURITY — On macOS, wildcard read-deny rules now win inside allowed read regions, cover the contents of matched directories, and can no longer be sidestepped by renaming the filePRICING — Claude Sonnet 5's introductory $2 per million input and $10 output ends August 31, with standard $3 and $15 pricing starting September 1. Ten days to goOUTPUT — v2.1.237 ships a built-in Concise output style that leads with results and skips preamble, without cutting any corners on the work itself. Pick it under Output style in /configCACHE — v2.1.237 fixes prompt caching for sessions running through an LLM gateway or a custom base URL. If you work behind a company proxy, your effective per-token cost just changedCONFIG — v2.1.236 adds ANTHROPIC_DEFAULT_MODEL to set which model new sessions start on. A /model pick still overrides it and persists across restarts, unlike ANTHROPIC_MODELNOTIFY — With notify_when_idle in v2.1.236, one Claude Code session can ask another on the same machine for a single heads-up when it next goes idle. Opt-in, one-shot, no pollingSECURITY — On macOS, wildcard read-deny rules now win inside allowed read regions, cover the contents of matched directories, and can no longer be sidestepped by renaming the filePRICING — Claude Sonnet 5's introductory $2 per million input and $10 output ends August 31, with standard $3 and $15 pricing starting September 1. Ten days to go
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 API117Cost ReportUsage API2cost allocationworkspaceindie dev10

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-04-25
Selling Knowledge Products with Claude API — Generating PDFs, Templates, and Newsletters That Actually Make Money
How to use Claude API to auto-generate and sell knowledge products — PDFs, templates, and newsletters — through platforms like Gumroad and Stripe. Includes working code examples.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →