Troubleshooting
The error code table, working through problems by status code and symptom, and what to have ready when you need to contact us.
When the gateway returns an error, the response body contains an error object. Its error.message explains the cause better than the status code. For most errors, the (request id: …) at the end of error.message identifies the request, and the X-Oneapi-Request-Id response header carries the same ID; the 404 "Invalid URL" message has no request id, so look in the response header instead.
Error codes
The "Error message" column shows the beginning of error.message; "…" stands for the specific model name, group name or number. The language of the message follows your account's language setting or the request's Accept-Language header. The messages below are the English wording.
| Status | Error message | Common causes | What to do |
|---|---|---|---|
| 401 | Invalid token | The key is mistyped, partly copied, or has a stray space or newline; the request carries no key, or the key is in the wrong header; the key is disabled, expired, or has used up its own quota | Copy the key again and check the header; check the key's status on the API Keys page. See 401 |
| 403 | Insufficient user quota, remaining quota: … | Your account balance has run out | Add funds in Wallet |
| 403 | Not enough quota to pre-consume for this request: … remaining, … required | The balance can't cover the pre-deduction for this request | Add funds and retry; see Pre-deduction and settlement |
| 403 | token quota is not enough, token remain quota: …, need quota: … | The key has a quota cap, and what's left can't cover the pre-deduction for this request | Edit the key and raise its quota, or turn on Unlimited Quota |
| 403 | This token has no access to model …; This token has no access to any models | The key has Model Limits on, and the requested model isn't on the list, or the list is empty | Edit the key and add the model to Model Limits, or use another key |
| 403 | No permission to access group …; Group … has been deprecated | The key's group is no longer open to your account, or has been retired | Edit the key and choose another group; see Changing a key's group |
| 403 | Your IP address is not on this token's allowlist | The key has an IP whitelist and the request's source address isn't on it | Add your outgoing IP to IP Whitelist (supports CIDR), or clear the whitelist |
| 403 | User has been banned | The account has been disabled | Contact us |
| 404 | Model … is not configured for any group available to this request | The model name is wrong; or the model isn't in the key's group | Copy the model name from Model Square; switch to a group that has the model, see Groups |
| 404 | Invalid URL (…) | The endpoint address is wrong, for example /v1 appears twice, or the gateway doesn't provide that endpoint |
Compare with how to write the base URL and the API reference |
| 400 | Model name not specified, model name cannot be empty | The request body has no model field |
Add model |
| 400 | Invalid request: … | The request body isn't valid JSON; model isn't a string, or appears more than once |
Check the format of the request body |
| 400 | Another message, with error.code invalid_request |
The request parameters don't match this endpoint's format, for example a required field is missing or a field has the wrong type | Compare with the API reference and the matching official API specification |
| 413 | Contains request body too large | The request body is larger than the gateway allows | Make the request smaller, for example compress images or attach fewer files at once |
| 400 | Model … has not been priced by the administrator yet | The model has no price yet and can't be called for now | Use another model, or contact us |
| 429 | You have reached the request limit: …; You have reached the total request limit: … | You sent more requests than the gateway allows within a period; the message gives the period and the count | Wait until the period has passed and try again; limit concurrency for batch calls |
| 429 | Any other message | The upstream provider is rate limiting | Retry later, with exponential backoff in your code |
| 503 | No available channel for model … under group … (distributor) | The model is in your key's group, but no channel is available right now | Try again later; or switch to another group that also has the model, or use another model |
| 500, 502, 504 and so on | The upstream's error message | The upstream provider or the network failed | Retry later; if the same model keeps failing, use another model and send us the request id |
A few more notes:
- A wrong model name (404) and no available channel (503) both have the
error.codemodel_not_found; tell them apart by the HTTP status code. - Insufficient quota has several messages: when the account balance is short you get "Insufficient user quota" or "Not enough quota to pre-consume"; when the key's own quota is short you get
token quota is not enough. When the key's quota is completely used up, the response is 401 "Invalid token". - When the upstream fails, the gateway may already have retried on another channel, and what you get is the last error. Whether it retries, and how many times, is a platform setting, and retries stay inside your key's group.
Common errors
401: invalid token
The key failed validation. All of the following cases return the same message:
- The key is mistyped, partly copied, or has a stray space or newline before or after it
- The request carries no key, or the key is in the wrong header: the OpenAI format uses
Authorization: Bearer; the Claude format usesx-api-keyorAuthorization: Bearer; the Gemini format usesx-goog-api-keyor?key=after the address - The key is disabled, expired, or has used up its own quota
Check the key's status on the API Keys page: only Enabled keys work, and Disabled, Expired and Exhausted keys all return 401.
403: insufficient quota or no access
A 403 means the key itself is valid, but this request was refused. error.message gives the reason: the balance or the key's quota is short, the model isn't in the key's Model Limits, the key's group isn't available, or the request's source isn't on the IP whitelist. Match it against the table above.
404: wrong address, or model not in the group
Most often a /v1 that is missing or doubled: the base URL for the OpenAI format is https://codaapi.com/v1, while Claude Code and the Anthropic SDK use https://codaapi.com. See Base URL for what each kind of tool needs. An extra /v1 (the request becomes /v1/v1/…) returns a 404 "Invalid URL". Without /v1 the request doesn't reach an endpoint but lands on the console's web pages, which may return 200 with a web page; the client doesn't get JSON back, and a parsing failure is the typical symptom.
If the error message says the model is not configured for any group available to the request, the address is fine and the model is the problem:
- The model name is wrong. Write it exactly as it appears in Model Square; see Model name
- This model isn't in your key's group. Choose your group under the Groups filter on the left of Model Square and check whether the model is there; if not, edit the key and switch to a group that has it, see Groups
429: too many requests
A rate limit was hit, either at the gateway or at the upstream provider. The gateway's rate-limit message gives the period and the count. Wait a while and try again. For batch calls, limit concurrency and use exponential backoff retries in your code.
503: no available channel
The error message looks like "No available channel for model … under group …": this model is in your key's group, but has no available channel right now. Try again later, or switch to another group that also has the model, or use another model.
A wrong model name, or a model that isn't in your key's group, returns 404 instead. Both errors have the error.code model_not_found; tell them apart by the HTTP status code.
5xx: upstream error
Errors such as 500, 502 and 504 mostly come from the upstream provider or the network. Retrying shortly afterwards usually recovers. If the same model keeps failing, try another model and send us the request id.
Streaming cuts off midway
- The read timeout of the client or a proxy is too short: long answers and reasoning models can take a long time to produce the first token, so we suggest a timeout of a few minutes
- Your local network or proxy is unstable
- For a request that is cut off midway, the part already generated is still billed
Self-service troubleshooting
Check in order. Most problems can be pinned down in the first two steps:
- Network and key: run
GET /v1/modelsas described in the environment check to confirm you can connect and the key is valid. - Balance and key: in the console, look at the balance in Wallet and the status and settings (group, quota, model limits, IP whitelist) of your API keys. For billing rules, see Pricing and multipliers.
- The request itself: does the model name match Model Square, and is the model in the key's group; do the API format and the base URL correspond (the OpenAI, Claude and Gemini formats can't be mixed); does the request body follow the matching official API specification.
- Usage logs: find this request in the usage logs and see which model and key it used and how much it charged.
- Compare with another client: if it fails in the tool but curl works, the problem is most likely the tool's configuration. Compare against the check steps on pages such as Claude Code and Codex.
Contact us
If you still can't solve it after troubleshooting on your own, reach us by email or WeCom support as described on the Contact page. Please include:
- Account: the email address or username you signed up with
- The failing request: when it happened, the model name, the key's name, and the request id from the error message
- The error text or a screenshot: the full error message
See What to include in a report for the full format. Never send your API key to anyone, including us. Troubleshooting only needs the key's name, never the key itself.