Error Codes

The Panda World API uses standard HTTP status codes and returns JSON error bodies consistent with the OpenAI error format.

Error Response Format

{
  "error": {
    "message": "Insufficient balance",
    "type": "insufficient_balance",
    "code": "insufficient_funds",
    "param": null
  }
}

HTTP Status Codes

StatusCodeDescription
200-Success
400invalid_request_errorMalformed request — check parameters, headers, or request body
401authentication_errorInvalid, missing, or revoked API key
402insufficient_balanceYour account balance is too low to process this request
404not_foundThe requested resource or model was not found
429rate_limit_errorToo many requests — slow down
500api_errorInternal server error — try again later
502upstream_errorUpstream model provider returned an error
503service_unavailableService temporarily unavailable — maintenance or overload

Common Error Scenarios

Authentication Error (401)

{
  "error": {
    "message": "Incorrect API key provided: sk-***abc. Check your key is correct.",
    "type": "authentication_error",
    "code": "invalid_api_key",
    "param": null
  }
}

Fix: Check your API key is correct and hasn't been revoked.

Insufficient Balance (402)

{
  "error": {
    "message": "Your account balance ($0.50) is insufficient for this request. Estimated cost: $0.75",
    "type": "insufficient_balance",
    "code": "insufficient_funds",
    "param": null
  }
}

Fix: Top up your account via the Dashboard.

Rate Limited (429)

{
  "error": {
    "message": "Rate limit exceeded: 100 requests per minute",
    "type": "rate_limit_error",
    "code": "rate_limited",
    "param": null
  }
}

Fix: Implement exponential backoff in your client. Check theRetry-After header for guidance.

Model Not Found (404)

{
  "error": {
    "message": "The model 'gpt-4o' does not exist",
    "type": "not_found",
    "code": "model_not_found",
    "param": null
  }
}

Fix: Check the correct model ID in our Models & Pricing page.

Rate Limit Headers

All API responses include rate limit headers:

HeaderDescription
X-RateLimit-LimitMax requests per minute allowed
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the window resets
Retry-AfterSeconds to wait before retrying (only on 429)

Best Practices

  • Always handle 401 errors by checking your API key
  • Implement exponential backoff with jitter for 429 and 5xx errors
  • Monitor your balance to avoid 402 errors
  • Retry 502/503 errors after a short delay — they are usually transient