Errors
Success and failure bodies use the same envelope:
401 Unauthorized
json
{
"error": {
"message": "Kunci API tidak valid.",
"type": "invalid_request_error",
"code": 401
},
"request_id": "req_8f3c1a"
}type is invalid_request_error for 4xx, insufficient_quota for 402, and server_error for 5xx. code is the HTTP status.
Middleware failures (authentication, rate limits) use a string code. An unknown path answers like this:
Middleware and 404
json
{ "error": { "message": "Kunci API tidak valid.", "type": "invalid_request_error", "code": "INVALID_API_KEY" } }
{ "error": "Not found", "path": "/v1/tidak-ada" }HTTP status
| Status | Meaning |
|---|---|
| 400 | Request validation failed, or the provider rejected the request. |
| 401 | The credentials are not valid. |
| 402 | Insufficient balance (chat). |
| 403 | Scope, IP, or account status does not allow it. |
| 404 | Model or endpoint not found. |
| 409 | The promo code has already been used. |
| 410 | The HTTP top-up endpoint is no longer available. |
| 422 | Request validation failed. |
| 429 | Rate limit exceeded. |
| 500 | Internal gateway error. |
Image and audio endpoints return 400
Insufficient credits, not 402 — only chat uses 402.Still haven't found the answer? Try it directly in Playground or view the list of active models.

