Anthropic integration

See the real cost of Claude—including prompt caching.

Observe Anthropic usage in your backend and keep cache reads, five-minute cache writes, one-hour cache writes, and normal input separate so each category can receive the right server-side price.

Start with your product

What it reads

Provider usage and request outcomes

  • Model, operation, provider request ID, and provider-returned token usage.
  • Uncached input, cache reads, five-minute and one-hour cache writes, and output.
  • Latency, completed streams, failures, timeouts, and cancellations.
  • Opaque product dimensions such as account, feature, and prompt version when you supply them.

What stays private

Claude still talks directly to your application

  • No prompts, message content, tool arguments, or Claude responses.
  • No Anthropic API key and no proxy between your app and Anthropic.
  • No customer email used as the revenue-to-cost join key.

How to connect

Instrument the client you already own

  1. Install one of the seven Grow or Die server SDKs.
  2. Create a write-only ingest key for the selected website.
  3. Wrap the Anthropic Messages client where transparent wrapping is supported, or observe the existing call with a typed helper.
  4. Consume streams to completion when you want final provider usage.
  5. Add opaque account and billing identifiers through the private identify call when customer profit is required.

What it unlocks

Cache-aware cost decisions

Grow or Die can rank model and feature cost, expose cache behavior, show cost per visitor, and identify cost-side profit leaks. With an exact identity and payment join, those costs can support customer-level contribution profit.

Current limits

Incomplete evidence does not become zero

Aggregate cache creation without a reliable TTL breakdown can remain unpriced. Provider-internal retries are outside the wrapper, and interrupted streams may report partial or unknown usage. Event-priced cost remains provisional until provider-organization billing is reconciled.

Primary source

Check the provider contract

See Anthropic’s official Messages API documentation for response usage and caching fields.

Claude cache and stream evidence

Keep every cache meter and text stream outcome distinct.

Grow or Die preserves the official Messages client, including the native text stream, while recording final usage exactly once after the helper finishes.

Five-minute and one-hour writes

Cache creation is not one price. Five-minute and one-hour cache writes remain separate, alongside base input, cache reads, and output.

Native text stream preserved

The wrapper does not buffer or replace the provider stream. Final usage is recorded once when the native stream helper completes.

Unknown duration blocks cost

If a non-zero cache write cannot be assigned to the observed duration and model price, cost stays unknown instead of using the cheaper rate.

Customer link stays opaque

Use a stable internal account ID and a separate server identity link. Do not join Claude usage to payment evidence through an email address.

Full implementation recipe

Anthropic cache read and write cost by customer

See the cache cost recipe for the server wrapper, cost boundary, and payer identity method.