Docs

AI API billing errors

Stable billing error codes returned by the LinkCode AI API, including safe retry behavior after adding credits.

The OpenAI-compatible AI API at https://gateway.linkcode.ai/v1 returns errors in this shape:

{
  "error": {
    "code": "insufficient_credits",
    "message": "The organization does not have enough credits for this request",
    "type": "billing_error"
  }
}

Use error.code for programmatic decisions. The message is for display and is not a stable identifier.

Stable billing codes

HTTP statuserror.codeMeaning and retry behavior
402insufficient_creditsThe organization cannot reserve enough credits. This response is generated before any upstream AI provider call, so no completion was started. After credits are added, retrying the same request is safe.
503billing_unavailableLinkCode Cloud could not establish or persist usage accounting. Retry with backoff. This error can occur either before an upstream call or after a provider response while the charge is being persisted, so do not assume that no completion was generated.

Both code values are stable client contracts. Continue to handle other HTTP statuses and unknown codes as general API failures.

On this page