What errors might occur when using the API?

The most common errors when working with the API are:

400 Body validation error! Your request body contains invalid or missing fields. Check the API schema for the selected model. The full error message usually includes hints like "Expected" and "Received" to show which parameter caused the issue.
400 Unsupported value: 'messages[0].role' does not support 'system' with this model. The provided role is not supported by the selected model. Check the API schema for the list of allowed values for messages[].role  and update your request accordingly.
403 You've run out of credits. Please top up your balance or update your payment method to continue: https://aimlapi.com/app/billing/ Your credits or plan limits have been exhausted. Top up your balance or update your payment method on the Billing page to continue using the API.
401 This request requires a valid API key. You can create a new API key on the Billing page: https://aimlapi.com/app/keys The request is not authenticated. The API key is missing, expired, or invalid. Pass a valid Authorization: Bearer <API_KEY>  header from the Keys page in your dashboard.
404

__

The requested endpoint or resource does not exist. Check the base URL, path (for example /v1/chat/completions ), and HTTP method used in your request.
429 Too Many Requests You have hit a rate or concurrency limit by sending too many requests in a short period of time. Reduce the request rate, add retries with backoff, or queue requests before calling the API again.
500 Internal server error An unexpected error occurred on our side while processing your request. Retry the call; if the problem persists, contact our support team.
500 Something wrong with the server. Please, try again later. A third-party service (including a partner model API) returned an error while processing your request. Your request is valid — try again a bit later or contact support if the problem persists.
500 Coupon code not found. The coupon / promo code you entered does not exist or is no longer valid. Check the code for typos or use a different coupon.
500 The model is under maintenance, please contact us at help@aimlapi.com. Your Request ID is "*". An unexpected error occurred in one of the services handling your request. Please try again later and, if the issue persists, contact our support team and include the Request ID.
502 Bad Gateway A downstream service or partner API returned an invalid response.
503 Service unavailable For some technical reason, the AI model or a partner service could not complete your request. Please try again later or contact our support team if the issue persists.
504 Generation timeout A downstream service or partner API returned an invalid response.

Detailed information is available in our Documentation.

If you encounter a different error, contact technical support.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us