Ошибки и отладка
RouteAPI по возможности возвращает единую структуру ошибки, чтобы клиент мог определить источник и способ обработки.
Standard error structure
Section titled “Standard error structure”{"error":{"message":"Invalid API key","type":"authentication_error","code":"invalid_api_key"}}Status codes
Section titled “Status codes”| Status | Type | Cause | Handling |
|---|---|---|---|
| 400 | Request error | Invalid parameter | Check request body |
| 401 | Authentication error | Invalid Token | Check Authorization |
| 402 | Balance error | Insufficient balance | Recharge or adjust quota |
| 404 | Path error | Endpoint missing | Check URL |
| 429 | Rate limit | Limit triggered | Reduce concurrency |
| 500 | System error | Internal error | Check logs |
Проверка
Section titled “Проверка”- Confirm URL, Token, and model ID.
- Confirm balance, quota, and permissions.
- Check console usage logs.
- Confirm SSE handling for streaming requests.
Error layers
Section titled “Error layers”| Layer | Пример |
|---|---|
| Client | JSON error or missing Token |
| RouteAPI | Insufficient balance or permission |
| Model service | Rate limit or unavailable service |
Production logs should include request time, Token, model ID, HTTP status, error code, and console log details.