Idempotency
Network and client retries are routine — a request may complete server-side even though the client believes it failed. Pass an Idempotency-Key header to make retries safe.
Format
1–128 characters of [A-Za-z0-9_\-.]. UUIDs and crypto-random strings work great. The key's uniqueness scope is per API key — two different keys can reuse the same value without colliding.
Guarantees today
- No double-charge. The credit ledger is uniquely indexed on your scoped key. A retry within 24h will not deduct credits a second time.
- Each retry still proxies to the provider. So you may receive an OpenAI-style response again, but your wallet won't move.
Coming next
Full request-response replay (return the exact original response from the cache without contacting the provider) lands when we add Redis to the gateway. Until then your client may see slightly different completion text on a retry.
Example
curl https://api.infra.models/v1/chat/completions \
-H "Authorization: Bearer im_live_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 7c1c2f01-9a31-4f5d-9c30-6e2c3df18a44" \
-d '{ "model": "im/anthropic-claude-3-5-haiku",
"messages": [{ "role": "user", "content": "Pick a number" }] }'