Documentation menu
Operations

Errors

Handle common TokenAir API errors in an OpenAI-compatible integration.

ReferenceLast updated: July 2, 2026

Common status codes

StatusMeaningWhat to do
400Invalid requestCheck JSON shape, required fields, and parameter names.
401Authentication failedCheck that the API key is present and valid.
403Access deniedConfirm the account has access to the requested model or feature.
404Model or endpoint not foundConfirm the endpoint path and model ID.
422Unsupported inputAdjust parameters for the selected model family.
429Rate limitedBack off, retry later, or request higher limits.
500-599Service or upstream errorRetry with backoff and inspect your request logs.

Retry guidance

Retry transient 429 and 5xx responses with exponential backoff and jitter. Do not retry invalid 400-level requests without changing the request.

first retry: 1s
second retry: 2s
third retry: 4s
add jitter: random 0-500ms

Do not retry these blindly

  • 401: fix the API key or environment variable.
  • 403: confirm account access to the model or feature.
  • 404: confirm the endpoint path and model ID.
  • 400/422: fix the request body before retrying.

Log safely

Log request IDs, status codes, model IDs, latency, and token counts. Do not log API keys. Avoid logging sensitive prompt or user data unless your own privacy policy and retention rules allow it.

Next steps