Idempotency
Why write commands take a key, and how a retry finishes without a second charge.
Every write needs idempotency_key of at least 8 characters. Send it as JSON idempotency_key, or as the Idempotency-Key header. MCP and REST share the key per workspace. The same key will not spend twice.
What you should do
- Pick a key per job, such as
comment-1orlike-1. Use a different key for a different job. - If the request times out, or you get
RATE_LIMITorPAYMENT_REQUIREDafter you buy credits, send the same key again. - Do not generate a new key on retry. A new key is a new spend if the first write actually landed.
get_usage and get_status have no key. They are reads.
What the server does
If a stored result already has an id and is not stuck in a pending crash window, the runner returns that result and does not run the command again.
A key shorter than 8 characters is PARSE. That check exists so a client cannot accidentally mint a new spend on every retry.
Do not reuse one key across different commands. The stored row is keyed by workspace plus key, and it records which command it belonged to.
Crash windows, in plain language
If the process dies after credits leave the wallet and before the comment is queued, a retry with the same key finishes the job instead of charging again. You do not need to handle that yourself. Send the same key.
The like recipe that uses this correctly is Comment then like.
Last updated on