← Blog

Claude API Invoice Billing Per Customer, Explained

2026-10-12 · 5 min read · SubToAPI Team

If you're reselling Claude access or building a product on top of it, you eventually hit the same wall: Anthropic's API gives you one bill for everything, but you need to know what each of your customers owes. "Claude API invoice billing per customer" usually means one thing — you need per-customer usage metering that maps cleanly to line items on an invoice, not just a total token count at the end of the month.

The short answer is that Anthropic's native API doesn't do this for you. There's no customer field, no sub-account billing, no per-tenant invoice export. You have to build the metering layer yourself, or use a proxy that already does it. Below is how to do both, plus the data model that makes invoicing painless instead of a monthly spreadsheet exercise.

Why Claude API billing per customer is hard by default

Anthropic bills you — the account holder — based on total tokens consumed across every request your API key makes. That key has no concept of "this request was for customer A, that one was for customer B." If you have five customers sharing your integration, Anthropic's dashboard shows you one number: total spend. Splitting that into five invoices requires you to tag every request yourself and reconcile it later.

This matters most for:

Without a tagging system, you're stuck estimating usage from logs after the fact — which is slow, error-prone, and impossible to audit when a customer disputes a charge.

The core pattern: tag every request with a customer ID

Regardless of whether you build this yourself or use a tool, the pattern is the same:

  1. Every outbound Claude API call carries a customer identifier (in your own system, not Anthropic's).
  2. You log tokens in + tokens out + model + timestamp against that identifier.
  3. At invoice time, you aggregate logs per customer and apply your pricing (flat markup, tiered, or pass-through).

A minimal logging table looks like this:

CREATE TABLE usage_events (
  id            BIGSERIAL PRIMARY KEY,
  customer_id   TEXT NOT NULL,
  model         TEXT NOT NULL,
  input_tokens  INT NOT NULL,
  output_tokens INT NOT NULL,
  cost_usd      NUMERIC(10,6) NOT NULL,
  created_at    TIMESTAMPTZ NOT NULL DEFAULT now()
);

Every request writes one row here. Invoicing is then just:

SELECT customer_id,
       SUM(input_tokens) AS total_in,
       SUM(output_tokens) AS total_out,
       SUM(cost_usd) AS total_cost
FROM usage_events
WHERE created_at >= '2025-01-01' AND created_at < '2025-02-01'
GROUP BY customer_id;

That query is your invoice source of truth. Feed it into Stripe's invoice items API, a CSV export, or whatever billing tool you already use.

Where this breaks in practice

Three things usually go wrong when teams build this in-house:

Using an API-key-per-customer approach instead

A cleaner alternative to in-app tagging is giving each customer (or each client project) their own API key, so usage separation happens at the request-auth layer instead of in application code. This is how SubToAPI's key system works: each application key (sub_live_...) is independently trackable, so usage and cost naturally segment by key without you writing a custom logging table.

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Summarize this invoice dispute."}]
  }'

If you issue one sub_live_ key per customer (or per client), every call made with that key is attributed automatically. The dashboard then shows per-key usage and cost without any manual reconciliation — which is exactly the data you need to generate per-customer invoices at the end of the month. This works the same way whether you're calling the Messages endpoint directly (/docs/messages), streaming responses (/docs/streaming), or using tool calls (/docs/tools).

This approach also solves the retry-double-counting problem for you, since usage is recorded server-side against the completed request, not against every attempt your client code makes.

Choosing a billing model once metering is solved

Once usage is correctly attributed per customer, pick a pricing model that matches how your customers think about cost:

Whatever you choose, keep raw token-level logs for at least one billing cycle past the invoice date — customers will ask for a breakdown, and "trust me" is not an acceptable answer when real money is involved.

Getting started quickly

If you don't want to build and maintain a usage-logging table, retry-safe metering, and a reconciliation query, start with a per-customer key structure from day one. SubToAPI gives every application its own key and tracks usage, cost, and request metadata per key automatically, so invoice data is just an export away instead of a custom SQL job. You can see the request format in the quickstart (/docs/quickstart) and check plan limits on the pricing page (/pricing) before committing — there's a free trial at signup (/signup) if you want to test metering accuracy against your own traffic first.

questions

Does Anthropic support per-customer billing natively? No. Anthropic bills the account as a whole; there's no customer or sub-account field on requests. You have to tag requests yourself or use a proxy/key system that separates usage by key.

What's the minimum data I need to generate an accurate invoice? Per request: customer ID, model, input tokens, output tokens, and timestamp. Store raw token counts, not just computed cost, so you can re-price later without re-running every request.

Can I avoid building a custom logging system entirely? Yes — issue a separate API key per customer through a service like SubToAPI, where usage and cost are tracked per key automatically, and export that data directly into your invoicing tool.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →