Keep your SDK. Add idempotency.
idem0 adds an atomic idempotency guarantee to your Anthropic and OpenAI calls. Same key, same call. It runs once, or not at all. No more double-billed retries, duplicate generations, or replayed requests.
$ npm i @idem0/sdk
import Anthropic from '@anthropic-ai/sdk';import { idem0, idempotencyKey } from '@idem0/sdk'; // BYOK: your provider token is forwarded, never storedconst client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, ...idem0({ idem0Key: process.env.IDEM0_KEY, provider: 'anthropic' }),}); const message = await client.messages.create( { model: 'claude-haiku-4-5', max_tokens: 1024, messages: [{ role: 'user', content: 'Hello' }], }, { headers: idempotencyKey('job-42') },);The second call never reaches the provider.
Two requests. One idempotency key. The first executes upstream, and its response is sealed into the store. The second returns that exact response (byte for byte) without ever touching the provider.
executed upstream · response sealed, AES-256-GCM
replayed from idem0-store · 0 upstream calls
Correctness, not caching.
Exactly-once execution
One idempotency key runs once: across retries, races, and duplicate delivery.
Byte-identical replay
A replayed key returns the original response byte for byte: same hash, same bytes.
Idempotent streaming
Non-streaming and SSE streaming responses are both made idempotent.
BYOK, never stored
Your provider token is forwarded upstream and never written to disk.
Sealed at rest
Every stored response is encrypted with AES-256-GCM before it touches the store.
Anthropic & OpenAI
Drop-in with the official SDKs. No client rewrite, no workflow changes.
Build agents on the providers you already use
Point your SDK at idem0, add an idempotency key, and every retry is free.