atomic idempotency at the edge

Idempotency infrastructure for AI agents

integration

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

index.ts
import Anthropic from '@anthropic-ai/sdk';
import { idem0, idempotencyKey } from '@idem0/sdk';
 
// BYOK: your provider token is forwarded, never stored
const 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 guarantee

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.

01first callmiss
request
POST /v1/messages
Idempotency-Key: job_RF-4021
response
200 OK · 929ms
idem0-idempotent-replayed: false
body sha256 3f9a…c21e

executed upstream · response sealed, AES-256-GCM

02same keyhit
request identical to 01
POST /v1/messages
Idempotency-Key: job_RF-4021
response
200 OK · 8ms
idem0-idempotent-replayed: true
body sha256 3f9a…c21e · identical

replayed from idem0-store · 0 upstream calls

what’s in the box

Correctness, not caching.

01

Exactly-once execution

One idempotency key runs once: across retries, races, and duplicate delivery.

02

Byte-identical replay

A replayed key returns the original response byte for byte: same hash, same bytes.

03

Idempotent streaming

Non-streaming and SSE streaming responses are both made idempotent.

04

BYOK, never stored

Your provider token is forwarded upstream and never written to disk.

05

Sealed at rest

Every stored response is encrypted with AES-256-GCM before it touches the store.

06

Anthropic & OpenAI

Drop-in with the official SDKs. No client rewrite, no workflow changes.

soon
soon
providers

Build agents on the providers you already use

Point your SDK at idem0, add an idempotency key, and every retry is free.