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{
2 "code": "INVALID_API_KEY",
3 "message": "Invalid API key"
4}
Failed requests that produce no usage are not charged, and every error in the tables below falls into that case. The one exception: if a streaming response is cut off halfway, you are charged for the usage the model actually generated. You can check every charge in Usage.

1. Keys and account

CodeStatusMeaningWhat to do
API_KEY_REQUIRED401The request has no API keyAdd Authorization: Bearer sk-… to the request headers (Anthropic clients can also use x-api-key, Gemini clients x-goog-api-key).
INVALID_API_KEY401The key does not exist or was entered incorrectlyCopy the full key from the API Keys page without extra spaces or line breaks. Keys from official platforms do not work here.
API_KEY_DISABLED401The key is disabledRe-enable it on the API Keys page, or create a new key.
API_KEY_EXPIRED403The key has expiredExtend its expiry on the API Keys page, or create a new key.
USER_INACTIVE401The account is disabledReach us via Contact to check your account status.
ACCESS_DENIED403Your IP is not on the key's allowlist, or is on its blocklistThe error message shows the IP we see. Edit the key on the API Keys page and update its IP restrictions.
GROUP_DISABLED
GROUP_DELETED
403The key's group has been disabled or retiredMove the key to another group on the API Keys page, or create a new key.
api_key_in_query_deprecated400The key was sent as a URL query parameterSend it in a request header instead, as shown in the first row.
INVALID_AUTH_RATE_LIMITED429Too many attempts with invalid keys from the same networkCheck your key, then try again in a few minutes.

2. Balance and limits

CodeStatusMeaningWhat to do
INSUFFICIENT_BALANCE403Your account balance is too lowTop up on the Top-up page and try again.
API_KEY_QUOTA_EXHAUSTED429This 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_exceeded429The key's 5-hour, daily or 7-day spending limit has been reached, or the per-minute request limit was exceededWait 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

CodeStatusMeaningWhat to do
gateway_concurrency_limit429Too many requests running at the same timeWait for earlier requests to finish, or lower your client's concurrency.
gateway_queue_full429Too many requests waiting in the queueWait and retry, backing off using the Retry-After header if present.
rate_limit_error429The model provider is rate limitingRetry later. If it persists, switch to a similar group.

4. Request content

CodeStatusMeaningWhat to do
invalid_request_error400The request format or parameters are wrong, for example a missing model, an empty body or invalid JSONFix the request as described in the message and retry.
model_not_found404This 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_error403This 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.
—404Wrong 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.

CodeStatusMeaningWhat to do
api_error503This group has no available line right now (returns “No available accounts …” or “Service temporarily unavailable”)Retry later, or switch to a similar group.
upstream_error502The model service returned an error or the connection droppedRetry later. If it persists, check the Status page or switch to a similar group.
overloaded_error503The model service is busyWait a few seconds to a few minutes, then retry.
billing_service_error503Our billing service is temporarily unavailableRetry later. If it persists, take a screenshot and reach us via Contact.
maintenance503ZhenAPI is under maintenanceRetry after the time in the Retry-After header; maintenance usually ends within a few minutes.
—Stream cut offA streaming response was interrupted halfwayYou 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.