Tokenify

Errors

The OpenAI error envelope, and a straight answer on which of these are worth retrying.

{
  "error": {
    "message": "Insufficient credit: this request needs up to $0.0042 but the balance is $0.0000.",
    "type": "insufficient_quota",
    "code": "insufficient_credit"
  }
}

Anthropic clients get the Anthropic envelope from /v1/messages instead. The code is stable and safe to branch on; the message is for a human and may be reworded.

Statuses

StatuscodeCauseRetry?
400invalid_bodyThe body is not JSON, or has no model field.No — fix the request.
400context_length_exceededThe prompt is longer than the model accepts.No — shorten it or use a longer-context model.
401invalid_api_keyMissing, malformed or revoked key.No.
403model_not_allowedThis key is restricted to other models.No — widen the key or name a permitted model.
402insufficient_creditThe balance cannot cover the worst case for this request.After topping up. The response carries X-Tokenify-Balance-Micro.
404model_not_foundNo such model, or it is disabled.No — GET /v1/models lists what is available.
409duplicate_requestA reservation already exists under this request id.Yes, immediately.
429rpm_exceeded / tpm_exceededThis key’s per-minute ceiling.Yes, after Retry-After. Back off.
429(from upstream)The supplier rate-limited us.Yes, with backoff. We try other suppliers first.
502upstream_unavailableEvery supplier for this model failed before responding.Yes. No credit was charged.
502translation_failedThe supplier answered and we could not render it in your dialect.Yes — and tell us the request id, because that one is ours.
503admission_unavailableWe could not verify credit for the request.Yes, with backoff.

What is never charged

Credit is reserved before a request is sent and released if nothing is generated. You are not charged for a 4xx the supplier rejected, for a request that never reached a supplier, or for one where every supplier failed. You are charged for tokens a supplier generated before a stream broke, because they generated them.

Retrying safely

Retries are safe: a request is only ever billed once, and a retry after a lost response is a new request rather than a duplicate charge. Use exponential backoff with jitter on 429, 502 and 503, and do not retry a 4xx that describes the request itself — every supplier will make the same judgement.

Always log x-tokenify-request-id. It is the only identifier that finds a request in our system, and quoting it lets support see exactly what happened to that one request.

Last updated 2026-09-28.