APIs and capabilities
Error Codes
What each HTTP status and error code means when a request fails, how to fix it, and whether you are charged.
When a request fails, the HTTP status tells you the broad category and the error code in the response (code, error.code or error.type) tells you the exact reason. The tables below are grouped by category, and each entry says what to do.
Response format
Errors caught before the request is forwarded, such as key or balance problems, use the first format below. Errors that happen while forwarding use the format of the API you called (Anthropic or OpenAI; native Gemini endpoints use the Google format), so clients and SDKs recognize them directly.
1. Keys and account
| Code | Status | Meaning | What to do |
|---|---|---|---|
API_KEY_REQUIRED | 401 | The request has no API key | Add Authorization: Bearer sk-… to the request headers (Anthropic clients can also use x-api-key, Gemini clients x-goog-api-key). |
INVALID_API_KEY | 401 | The key does not exist or was entered incorrectly | Copy the full key from the API Keys page without extra spaces or line breaks. Keys from official platforms do not work here. |
API_KEY_DISABLED | 401 | The key is disabled | Re-enable it on the API Keys page, or create a new key. |
API_KEY_EXPIRED | 403 | The key has expired | Extend its expiry on the API Keys page, or create a new key. |
USER_INACTIVE | 401 | The account is disabled | Reach us via Contact to check your account status. |
ACCESS_DENIED | 403 | Your IP is not on the key's allowlist, or is on its blocklist | The error message shows the IP we see. Edit the key on the API Keys page and update its IP restrictions. |
GROUP_DISABLEDGROUP_DELETED | 403 | The key's group has been disabled or retired | Move the key to another group on the API Keys page, or create a new key. |
api_key_in_query_deprecated | 400 | The key was sent as a URL query parameter | Send it in a request header instead, as shown in the first row. |
INVALID_AUTH_RATE_LIMITED | 429 | Too many attempts with invalid keys from the same network | Check your key, then try again in a few minutes. |
2. Balance and limits
| Code | Status | Meaning | What to do |
|---|---|---|---|
INSUFFICIENT_BALANCE | 403 | Your account balance is too low | Top up on the Top-up page and try again. |
API_KEY_QUOTA_EXHAUSTED | 429 | This key's own quota is used up (shown as insufficient_quota in the OpenAI format) | Raise or remove the key's quota on the API Keys page. |
rate_limit_exceeded | 429 | The key's 5-hour, daily or 7-day spending limit has been reached, or the per-minute request limit was exceeded | Wait for the limit window to reset, or adjust the limits on the API Keys page. Back off using the Retry-After header if present. |
3. Too many requests
| Code | Status | Meaning | What to do |
|---|---|---|---|
gateway_concurrency_limit | 429 | Too many requests running at the same time | Wait for earlier requests to finish, or lower your client's concurrency. |
gateway_queue_full | 429 | Too many requests waiting in the queue | Wait and retry, backing off using the Retry-After header if present. |
rate_limit_error | 429 | The model provider is rate limiting | Retry later. If it persists, switch to a similar group. |
4. Request content
| Code | Status | Meaning | What to do |
|---|---|---|---|
invalid_request_error | 400 | The request format or parameters are wrong, for example a missing model, an empty body or invalid JSON | Fix the request as described in the message and retry. |
model_not_found | 404 | This group does not have the model (returns “Model … is not supported by any configured account in this group”) | Check which models the group offers on Pricing and copy the exact model ID, or switch to a group that has the model. |
permission_error | 403 | This group cannot generate images (returns “Image generation is not enabled for this group”) | Switch to a group that supports images; see the group list in the image generation guide. |
| — | 404 | Wrong endpoint URL (returns “404 page not found”) | Use https://api.zhenapi.ai/v1 for the OpenAI format and https://api.zhenapi.ai for the Anthropic format. Do not end up with /v1/v1. |
5. Model services and ZhenAPI
These errors come from the upstream lines or model services and have nothing to do with your key or account. You can check whether each group is healthy on the Status page.
| Code | Status | Meaning | What to do |
|---|---|---|---|
api_error | 503 | This group has no available line right now (returns “No available accounts …” or “Service temporarily unavailable”) | Retry later, or switch to a similar group. |
upstream_error | 502 | The model service returned an error or the connection dropped | Retry later. If it persists, check the Status page or switch to a similar group. |
overloaded_error | 503 | The model service is busy | Wait a few seconds to a few minutes, then retry. |
billing_service_error | 503 | Our billing service is temporarily unavailable | Retry later. If it persists, take a screenshot and reach us via Contact. |
maintenance | 503 | ZhenAPI is under maintenance | Retry after the time in the Retry-After header; maintenance usually ends within a few minutes. |
| — | Stream cut off | A streaming response was interrupted halfway | You are charged for the usage the model actually generated, which you can check in Usage. Simply retry. |
Still stuck?
Send us a screenshot of the error code, the full error message, the time of the request and the model you used via Contact. Do not share your full API key; the key name or its first few characters is enough.
Error codes are based on what the current version of ZhenAPI actually returns. Last checked: 2026-11-20.