diff --git a/pages/generative-apis/api-cli/understanding-errors.mdx b/pages/generative-apis/api-cli/understanding-errors.mdx index 2929c1b86f..af611e2ecf 100644 --- a/pages/generative-apis/api-cli/understanding-errors.mdx +++ b/pages/generative-apis/api-cli/understanding-errors.mdx @@ -3,24 +3,47 @@ title: Understanding common errors with Generative APIs description: This page explains how to understand errors with Generative APIs tags: generative-apis ai-data understanding-data dates: - validation: 2025-05-12 + validation: 2025-10-07 posted: 2024-09-02 --- Scaleway uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error caused by the information provided, and codes in the 5xx range show an error from Scaleway servers. -If the response code is not within the 2xx range, the response will contain an error object structured as follows: +If the response code is not within the 2xx range, the response will contain an error object. The structure of the error object depends on how recent the model being used is: -``` -{ - "error": string, - "status": number, - "message": string -} -``` + -Below are usual HTTP error codes: + + Recent models, such as Mistral Small 3.2, GPT-OSS 120b and Qwen3 235b, use the following error format: + ``` + { + "error": { + "message": string, + "type": string, + "param": null, + "code": number + } + } + ``` + + + + Legacy models, such as Llama 3.3 and Gemma 3, use the following error format: + ``` + { + "object": "error", + "message": string + "type": string, + "param": null, + "code": number + } + ``` + We are gradually upgrading the error message format for legacy models, to bring them in line with the format for recent models. + + + +Below are common HTTP error codes: - 400 - **Bad Request**: The format or content of your payload is incorrect. The body may be too large, or fail to parse, or the content-type is mismatched. - 401 - **Unauthorized**: The `authorization` header is missing. Find required headers in [this page](/generative-apis/api-cli/using-generative-apis/)