1
Install
@anthropic-ai/sdk or openai.2
Get your key
Grab an idem0 key from your dashboard and export it. This is your idem0 key (
x-idem0-key) — not your provider key.3
Make your first call
Spread
idem0(...) into the provider client once, and drop idempotencyKey(...) into the call. Your provider key rides in the SDK’s own apiKey, untouched (BYOK).endpoint defaults to the hosted proxy (https://api.idem0.dev) — you only pass it when self-hosting.4
See the replay (the whole point)
Run the exact same request twice and watch the second one come back from cache. Here it is with raw First call — the model runs, you’re billed one call. No replay header:Second call, same That
curl -i so you can see the response headers — use an Idempotency-Key you haven’t used yet, then run the command a second time unchanged:Idempotency-Key — idem0 returns the stored response byte-for-byte, and bills you nothing:idem0-idempotent-replayed: true is the tell: no model ran, no credit spent. Same key, same answer. (OpenAI is identical — POST https://api.idem0.dev/openai/v1/chat/completions with Authorization: Bearer $OPENAI_API_KEY.)What next
Concepts
Pick good keys and understand the 30-day replay window.
API reference
The full SDK surface and HTTP contract.