Errors
Error bodies and fixes for 401, insufficient quota, model restrictions, no available channel, invalid parameters, endpoint/model mismatch, 429 and timeouts.
Start with the HTTP status code and error.code / error.message in the response body. All error bodies share the same structure:
{
"error": {
"code": "...",
"message": "... (request id: 2026...)"
}
}The examples omit the type field (error type identifier); rely on error.code and error.message to diagnose.
Keep the request id at the end of message. Include it when you contact us, and use it to find that exact request in Usage Logs.
The request id is omitted from the error bodies below.
| Status | Common cause | Go to |
|---|---|---|
| 401 | Key invalid, missing or deleted | 401 |
| 403 | Insufficient quota, or the key may not access the model | Insufficient quota, Model restricted |
503 model_not_found | Wrong model name, or no available channel for the model | Model not found |
4xx/5xx invalid_request | Missing fields or invalid parameters | Invalid request parameters |
| 4xx/5xx | Wrong endpoint: the chosen model doesn't support it | Endpoint and model mismatch |
| 5xx (upstream) | The upstream model service failed | Upstream errors |
| 429 | Too many requests | 429 |
| Timeout / 524 | Response too slow | Timeouts |
401 Invalid token
{
"error": {
"code": "",
"message": "Invalid token"
}
}Checklist:
- Is the key complete and does it start with
sk-? - Is the header
Authorization: Bearer sk-...? (The Anthropic format also acceptsx-api-key: sk-....) - Is the environment variable actually set? Run
echo ${#MYAIEXP_API_KEY}and check the length is not 0. - Was the key deleted, disabled or expired on the API Keys page?
- Did a newline, space or other invisible character get into the key? In that case there is sometimes no JSON body at all, just a 400 with an empty body. Copy the key again.
- Is the base URL correct? OpenAI format:
https://ai.myaiexp.com/v1; Anthropic format:https://ai.myaiexp.com.
Insufficient quota
HTTP 403:
{
"error": {
"message": "token quota is not enough, token remain quota: $..., need quota: $...",
"param": "",
"code": "pre_consume_token_quota_failed"
}
}Meaning: this key's remaining quota (remain quota) is lower than the estimated quota this request needs (need quota). Fix:
- Raise the key's quota on the API Keys page, or make it unlimited.
- If the key is fine, check whether your account balance has also run out; top up or redeem a code on the Wallet page.
- The estimate depends on
max_tokensand input length; a smallermax_tokenslowers it.
Model restricted by key
HTTP 403:
{
"error": {
"code": "",
"message": "该令牌无权访问模型 your-model-id"
}
}(The message means "this key has no access to model your-model-id".) The key has a model restriction that doesn't include the requested model. Edit the key to add the model to its allowed list, or remove the restriction.
Model not found / no available channel
HTTP 503:
{
"error": {
"code": "model_not_found",
"message": "分组 default 下模型 your-model-id 无可用渠道(distributor)"
}
}(The message means "no available channel for model your-model-id in group default".) Note that this is not a 404. Common causes:
- The model name is misspelled or has the wrong case (model IDs are case-sensitive).
- This service doesn't currently offer the model (see the live list on the model square).
- The model temporarily has no available upstream channel.
Fix: call GET /v1/models to see which models the current key can use, or check the model square, then copy the exact model ID and try again.
Invalid request parameters
Example response when a required field is missing:
{
"error": {
"message": "field messages is required",
"param": "",
"code": "invalid_request"
}
}The HTTP status for these errors may be 4xx or 5xx, so rely on error.code and message, not the status code alone. Check the endpoint's required fields: the OpenAI format needs model and messages, the Anthropic format also needs max_tokens, and the Responses format uses input instead of messages.
Endpoint and model mismatch
Endpoint support varies by model: /v1/chat/completions is the general OpenAI-compatible endpoint; /v1/messages works with models that support the Claude-native format; /v1/responses works with models that support the Responses API. The available models and the endpoints each one supports are listed on the model square.
Calling a model through an endpoint it doesn't support returns an error (the exact status and message depend on the upstream). It means the model doesn't support this endpoint: check the model square for the endpoints that model supports, then switch to a matching endpoint or pick a model that supports the current one. Common cases:
- A model without Claude-native support configured in Claude Code: Claude Code uses
/v1/messages. - A model without Responses API support configured in Codex CLI: Codex CLI uses
/v1/responses.
Upstream errors
The request passed this service's authentication, but the upstream model service returned an error. These errors are unrelated to your key or quota.
Upstream internal error, HTTP 500:
{
"error": {
"message": "System error, please retry later.",
"code": "bad_response_status_code"
}
}Fix: first confirm the model supports the endpoint you're calling (see the previous section). Retry 5xx errors later; if they persist, switch to another model and contact us with the request id.
429 Rate limited
429 means the request rate exceeded a limit, either on this service or at the upstream model vendor. What to do:
- Read the
Retry-Afterresponse header (if present) and wait accordingly. - Retry with exponential backoff: wait 1 s, 2 s, 4 s… with random jitter, up to 3 to 5 retries.
- Lower your concurrency; don't fire off a large burst of requests at once.
- The official OpenAI / Anthropic SDKs retry automatically; tune with
max_retries.
If you are rate limited consistently over a long period, contact us.
Timeouts
Generating long text can take tens of seconds or longer. A non-streaming request that exceeds the time limit of an intermediate network layer (CDN, reverse proxy) is cut off, typically showing up as 504 / 524 or a client read timeout.
Fix:
- Prefer streaming: data keeps flowing, so the connection isn't dropped as idle.
- Increase the client timeout. Python:
OpenAI(timeout=120); Node:new OpenAI({ timeout: 120_000 }). - Shorten the output (lower
max_tokens) or switch to a faster model. - Thinking (reasoning) models think for a long time and are better used with streaming.
Still stuck?
When you contact us, include: the time, the endpoint and model name, the key's name (never send the key itself), and the request id from the full error body.
This service is provided for learning and research purposes only. Please follow each model provider's usage policies.