Behaviour
Errors
The error format, every error code, and what to do about each.
Errors use the OpenAI format, with AlphaProxy's request ID added:
{
"error": {
"message": "The API key is invalid, expired, or revoked.",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
},
"request_id": "..."
}
When it's worth waiting before a retry, the response has a Retry-After header in seconds.
Codes
| Status | code |
Meaning | What to do |
|---|---|---|---|
| 400 | unsupported_parameter |
A field isn't supported, such as tools or n above 1. |
Remove the field. |
| 400 | unexpected_field |
The body has a field the endpoint doesn't take. | Check the field names. |
| 400 | unsupported_message_role |
A message has a role other than system, user or assistant. |
Fix the message roles. |
| 400 | max_tokens_exceeded |
max_tokens is above your plan's limit. |
Lower it. See Limits. |
| 400 | model_cannot_see_images |
Images were sent to a text-only model. | Choose a model with image in its modalities. |
| 401 | invalid_api_key |
The key is missing, invalid, expired or revoked. | Check the Authorization header and the key. |
| 403 | insufficient_scope |
The key lacks the permission this endpoint needs. | Create a key with that permission. |
| 403 | plan_capability_blocked |
Your plan doesn't include this model. | Choose a model from GET /models, or change plan. |
| 429 | rate_limit_exceeded |
Too many requests this minute, or too many at once. | Wait for Retry-After, then retry. |
| 429 | free_quota_exceeded |
The free allowance is used up. | Add balance or wait for it to reset. |
| 502 | model_service_error |
The model's provider returned an error. | Retry, or try another model. |
| 503 | matrix_unavailable, service_unavailable |
A service is briefly unavailable. | Retry after Retry-After. |
| 500 | internal_server_error |
Something went wrong on our side. | Retry, and contact support with the request_id if it persists. |
Retrying
Retry 429, 502 and 503 with exponential backoff, honouring Retry-After. Don't retry 400, 401 or 403 without changing the request.