Skip to main content
When calling the API, the response code consists of two parts: the outer layer is the HTTP status code, and the inner layer is the business error code defined by Z.AI in the response body, which provides a more detailed error description.

Error Shapes

Errors are always returned as JSON, with a top-level error object that includes a code and message value.

Error Example

The following is the response message of a curl request, where 401 is the HTTP status code and 1001 is the business error code.
Note: When using streaming (SSE) calls, if the API terminates abnormally during inference, the above error codes will not be returned. Instead, the reason for the exception will be provided in the finish_reason parameter of the response body. For details, please refer to the description of the finish_reason parameter.