Errors and Debugging
RouteAPI tries to return a unified error structure so clients can identify the error source and handling method.
Standard error structure
Section titled “Standard error structure”{ "error": { "message": "Invalid API key", "type": "authentication_error", "code": "invalid_api_key" }}Common status codes
Section titled “Common status codes”| Status code | Type | Common cause | Suggested handling |
|---|---|---|---|
| 400 | Request error | Bad parameter format or unsupported model parameter | Check request body and model capability |
| 401 | Authentication error | Missing, wrong, or deleted Token | Check Authorization |
| 402 | Balance error | Insufficient user balance or exhausted Token quota | Recharge or adjust quota |
| 404 | Path error | Endpoint does not exist | Check URL |
| 429 | Rate limit | User, Token, or system rate limit | Reduce concurrency or adjust rate limit |
| 500 | System error | RouteAPI internal error | Check service logs |
Troubleshooting order
Section titled “Troubleshooting order”- Confirm request URL, Token, and model ID.
- Confirm the Token owner balance, quota, and access permissions.
- Check console usage logs to confirm whether the request entered RouteAPI.
- For streaming requests, confirm the client handles SSE correctly.
Service-side errors and local errors
Section titled “Service-side errors and local errors”RouteAPI is a gateway system. Errors may come from three layers:
| Layer | Example |
|---|---|
| Client | Request body JSON error, missing Token |
| RouteAPI | Insufficient balance, no permission |
| Model service | Service rate limit, service unavailable, model offline |
For production troubleshooting, record these fields together:
- Request time
- Token or user ID
- Model ID
- HTTP status code
- Error code returned by RouteAPI
- Error information in console usage logs