We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Errors

Account

Errors

Every error code the api14 gateway returns, what causes it, how the OpenAI error shape is structured and how to handle each failure in code.

Errors use the OpenAI error shape, so the official SDKs turn them into their normal exceptions (APIError, RateLimitError, AuthenticationError and so on). Branch on code; message is a human-readable explanation in English.

{
  "error": {
    "message": "This request may cost up to $0.0123 but your balance is $0.0040. Add funds at /pricing.",
    "type": "insufficient_quota",
    "code": "insufficient_balance"
  }
}

Failed requests are not charged. Any response with a 4xx or 5xx status costs nothing.

Gateway error codes

StatuscodetypeMeaning
400model_requiredinvalid_request_errorThe model field is missing.
400invalid_jsoninvalid_request_errorThe body is not a JSON object.
400invalid_bodyinvalid_request_errorThe multipart body could not be read.
400max_tokens_too_largeinvalid_request_errorA playground trial request asked for too many output tokens.
401invalid_api_keyauthentication_errorThe key is missing, malformed or revoked.
402insufficient_balanceinsufficient_quotaYour USD balance is $0 or below the estimated maximum cost of the request (input, output cap, images or video duration). The request is not sent.
403model_not_allowedpermission_errorThe key's model allowlist does not include this model.
403plan_requiredpermission_errorYour plan does not include this model category.
404model_not_foundnot_found_errorThe model id is unknown, disabled or removed.
404not_foundnot_found_errorUnknown endpoint, or a video job or generation that is not yours.
413payload_too_largeinvalid_request_errorThe request body exceeds the size limit (25 MB by default).
429rate_limitedrate_limit_errorRequests per minute exceeded. Comes with Retry-After: 60.
409idempotency_conflictapi_errorA request with this Idempotency-Key was already sent. Use a new key to send another request. See Rate limits.
429daily_limit_reachedrate_limit_errorThe key reached its daily USD spend limit.
403site_not_allowedpermission_errorWidgets only: the page's site is not in your allowed widget sites. See Widgets.
429widget_daily_limitrate_limit_errorWidgets only: the widget, or all widgets together, reached the daily USD spend limit.
429visitor_daily_limitrate_limit_errorWidgets only: this visitor reached the daily request limit set in Widget controls.
502upstream_unavailableapi_errorThe upstream provider could not be reached.
4xx/502content_unavailablevariesA video's content could not be fetched yet (status mirrors the upstream, 502 if none).
503maintenanceservice_unavailableMaintenance mode, generation endpoints are paused, GET endpoints still work.
503not_configuredservice_unavailableThe gateway is not configured yet.

Upstream errors

Errors returned by the upstream provider, for example an invalid parameter for a specific model, a context length overflow, a content-policy refusal or a provider's own 429, are passed through with their original status code and the same { error: {... } } shape.

What to do

StatusRetry?Action
400NoFix the request body.
401NoCheck the key and the Authorization: Bearer header. See Authentication.
402NoAdd funds or turn on auto top-up.
403NoUse an allowed model, edit the key's allowlist, or upgrade your plan.
404NoCheck the model id on the models page.
413NoSend a smaller body, or pass files by URL instead of base64.
429Laterrate_limited: wait for Retry-After. daily_limit_reached: wait for the next UTC day or raise the key limit. See Rate limits.
502YesRetry with backoff, or add model fallbacks.
503YesRetry later.

Handling errors in code

import OpenAI from 'openai'

const client = new OpenAI({ baseURL: 'https://api14.com/api/v1', apiKey: process.env.API14_API_KEY })

try {
  await client.chat.completions.create({ model: 'openai/gpt-5-mini', messages: [{ role: 'user', content: 'Hi' }] })
} catch (err) {
  if (err instanceof OpenAI.APIError) {
    console.error(err.status, err.code, err.message)
    if (err.code === 'insufficient_balance') {
      // prompt the user to add funds
    }
  } else {
    throw err
  }
}
from openai import OpenAI, APIStatusError

client = OpenAI(base_url="https://api14.com/api/v1", api_key="sk-api14-...")

try:
    client.chat.completions.create(model="openai/gpt-5-mini", messages=[{"role": "user", "content": "Hi"}])
except APIStatusError as e:
    print(e.status_code, e.code, e.message)

Errors that occur after a stream has started arrive inside the stream. See Streaming.