Skip to Content
Errors & Limits

Errors & limits

The Gateway API returns errors in an OpenAI-compatible shape:

error.json
{
  "error": {
    "message": "Invalid API key.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  },
  "request_id": "req_accly_1779290000000_0123456789abcdef"
}

Use error.code for programmatic handling. Error messages are written for humans and can change. Include request_id when contacting support; the same value is returned in X-Request-ID and X-Accly-Request-ID response headers.

Authentication errors

HTTP statusCodeMeaning
401missing_api_keyAPI key is missing or empty
401invalid_authorization_headerAuthorization header is malformed or does not use the Bearer scheme
401invalid_api_keyAPI key is revoked, expired, or invalid
401missing_sessionAccly app session cookie is missing or empty
401invalid_sessionAccly app session cookie is invalid or expired
402subscription_suspendedRenewal payment failed and Accly suspended model access
403account_restrictedAccount is currently restricted
429auth_rate_limit_exceededToo many failed authentication attempts from the same source

Example:

missing-key.json
{
  "error": {
    "message": "API key is required.",
    "type": "authentication_error",
    "code": "missing_api_key"
  },
  "request_id": "req_accly_1779290000000_0123456789abcdef"
}

Request errors

HTTP statusCodeMeaning
400invalid_bodyRequest body could not be read
400invalid_jsonRequest body could not be parsed
400missing_modelmodel is required
400missing_messagesmessages is required and must not be empty
400vision_not_supportedRequest included vision input for a model without vision support
400context_too_largeInput exceeded Accly token policy
403model_not_allowedYour key group or plan cannot use that endpoint or model tier
404model_not_foundModel ID was not found
404model_route_not_foundNo route exists for the requested model/category/mode
405method_not_allowedThe endpoint only accepts POST
500missing_user / missing_planRequest could not be associated with a valid account or plan

Limit errors

Limit errors use type: "rate_limit_error" and a more specific code.

HTTP statusCodeMeaning
429rate_limit_exceededRPM limit reached
429daily_limit_exceededDaily request limit reached
429budget_exceededDaily Balanced or Premium budget is exhausted
429free_balance_exhaustedFree one-time model balance is exhausted
429concurrency_queue_timeoutToo many active requests; queued request timed out
429auth_rate_limit_exceededFailed authentication attempts exceeded the gateway auth-abuse guard

Daily budgets and daily request limits reset at midnight UTC. RPM resets on the short rolling minute window.

Provider and availability errors

The gateway maps provider failures into Accly error codes where possible.

Typical statusCodeMeaning
400context_length_exceededProvider or model context limit was exceeded
400content_policy_violationProvider rejected content for policy reasons
429upstream_rate_limitUpstream provider or route is rate limited
502provider_errorProvider request failed
502provider_bad_gatewayProvider returned a bad gateway-style error
503no_available_providerNo available provider route could serve the request
503provider_unavailableProvider unavailable
503provider_auth_invalidProvider route auth failed
503provider_balance_exhaustedProvider route balance unavailable
504provider_timeoutUpstream provider timed out

Provider and availability errors can be temporary. If the request is safe to retry, wait briefly and try again. If the error keeps happening, choose another supported model or contact support with the request ID.

Handling errors in code

handle-errors.ts
const errorBody = await response.json().catch(() => null)
const code = errorBody?.error?.code
 
if (code === 'rate_limit_exceeded') {
  // Wait and retry later.
}
 
if (code === 'budget_exceeded' || code === 'free_balance_exhausted') {
  // Stop retrying until the user changes plan or the daily reset happens.
}
 
if (code === 'model_not_allowed') {
  // Ask the user to choose a model allowed by their plan.
}