401
This usually means the API key is wrong, or the API key does not have permission.
Check in this order:
- Confirm that your request header really includes:
Authorization: Bearer <your API key> - Confirm that the address you are calling is:
https://www.su8.codes/v1/... - Generate a new API key in the console and try again. Do not mix it up with an old API key.
404 / model not found
This is usually caused by:
- Wrong path, such as missing
/v1 - Wrong model name
Copy a model name from here and try again:
429
This usually means you are being rate limited.
What to do:
- Lower concurrency first. Do not send too many requests at once.
- Add retries, such as 1s/2s/4s with gradually longer waits.
- If your script loops requests, add a little random jitter so requests do not all rush in at the same time.
502 / 504 (gateway timeout)
This is usually caused by a non-streaming request waiting too long for a response, which triggers the 100-second forced cutoff mechanism of fronting CDNs such as Cloudflare.
What to do:
- Strongly recommended: always enable streaming output in your code or request body (
"stream": true). Once the model starts outputting token by token, the connection is no longer idle, which avoids CDN interception of long responses. - If your application is forced to use non-streaming mode, shorten the prompt or switch to a faster model.
5xx
This is usually a temporary server-side fluctuation.
Recommendations:
- Add retries with backoff.
- Add a request timeout so the request does not hang forever.
- If errors always happen during the same time period, try again at another time.
