Browse documentation

API reference

Errors

The OpenAI envelope, every code, and the action to take.

Every error uses the OpenAI envelope:

{
  "error": {
    "message": "Insufficient balance.",
    "type": "insufficient_quota",
    "code": "insufficient_quota"
  }
}

The codes#

HTTPcodeWhat to do
401missing_authorizationNo Authorization header.
401invalid_authorizationMalformed header — expected Bearer <key>.
401invalid_api_keyUnknown or revoked key. Prompt for re-authentication.
403account_inactiveThe account is not active. Contact us.
403model_not_allowedYour plan does not open this model. Change model or plan.
402insufficient_quotaEmpty wallet. Top up.
402spend_cap_exceededMonthly cap reached. Raise or clear it.
429rate_limit_exceededHonour the Retry-After header and retry.
404model_not_foundUnknown model. Refresh the list from /v1/models.
400invalid_bodyInvalid request body.
400model_lacks_visionImage sent to a model without vision. Not billed.
502upstream_unreachableTransient upstream failure. Retry with backoff.

The order of the checks#

The checks run in a deliberate order: model access before balance. A plan that cannot use a model is a permanent condition, and telling someone to top up for a request that will be refused anyway is the wrong message in the wrong order.

Always log the request id#

Every response carries x-gamra-request-id. It is also the idempotency key the usage ledger records — without it, a disputed request cannot be found.