Retrying an avatar create: same Idempotency-Key, one $0.95 charge

If an avatar create call times out, retry with the same Idempotency-Key. Sume returns the original job and does not bill a second $0.95 creation.

5 min readSume
All posts

When an avatar create request times out or drops, retry the submit with the same Idempotency-Key and the same body. Sume's Jobs and results page says the retry returns the original job and does not bill a second one. Avatar creation is a flat $0.95 per avatar, so a blind retry with a fresh key could create and charge for a second avatar.

The rule from the docs

The docs tell you not to submit a new paid job for the same intent once you have a job id, and to continue with GET status_url. Retrying the submit itself is the one safe repeat, and it requires the same key.

  • Same key, same body: the original job comes back.
  • New key for the same intent: treat it as a new job.
  • Same key, different body: refused; see the 409 post.

A key scheme that survives restarts

Build the key from your own data, for example avatar-<brand>-<handle>-v1, and store it before the call. If your worker restarts after the call left but before the reply arrived, it can resend the identical request and get the same job back.

Then poll

Read status_url from the response, poll until completed, then fetch the result for the avatar handle. See Create new avatar for the request shapes and the compatibility aliases.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume