KONG API AI Docs Start free

Developers

Errors

The error codes of the KONG API AI API: status, code, what it means and what to do in each case.

The shape of an error

Every error is JSON of the same shape:

JSON
{"error": {"code": "key_limit", "message": "…"}}

Handle errors by code. The message is for people and may change.

Error codes

StatusCodeMeaning and what to do
400invalid_jsonThe body is not valid JSON.
400model_requiredThe model field is missing.
400unknown_modelThe model is not in the catalog. See Models and prices.
401unauthorizedThe key is missing or not valid.
402key_limitThe key reached its monthly limit. Raise the limit or wait for the new month.
402budget_exceededA limit of the member, customer or workspace ran out.
402insufficient_budgetThe available credits cannot hold the most this request could cost. Add credits.
403key_paused, key_revokedThe key is paused or revoked.
403model_forbiddenThe model is outside this key's models.
403application_disabled, customer_disabledThe app or the customer is turned off.
404not_foundThe address is not supported, or the request was not found.
409duplicate_requestA request with this Idempotency-Key was already accepted. Read its state at /v1/requests/{id}.
409idempotency_conflictThe same Idempotency-Key with a different body. Use a new ID.
413body_too_largeThe body is over 2 MB.
429own_quota_unavailableNone of your own sources can serve and credits fallback is off.
429tenant_rate_limitToo many requests. Retry after the time in the Retry-After header.
503workspace_pausedAn admin paused all keys.
503queue_timeoutNo suitable source within the waiting time. Retry later.
503gateway_overloaded, drainingThe system is full or being updated. Retry in a few seconds.

Which errors to retry

  • Retry: 429 and 503. Wait for Retry-After if it is there, and keep the same Idempotency-Key so you are not charged twice.
  • Do not retry: 400, 401, 403, 413. Fix the request or the key.
  • Needs a person: 402. Raise the limit or add credits.

Are failed requests charged

No. Failed requests are not charged. If the outcome is unknown, the amount stays on hold until it is reconciled, then it is settled or released.