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.

HTTP Status Code

CodeReasonSolution
200Business processing successful-
400Parameter errorCheck if the interface parameters are correct
400File content anomalyCheck if the jsonl file content meets the requirements
401Authentication failure or Token timeoutConfirm if the API KEY and authentication token are correctly generated
404Fine-tuning feature not availableContact customer service to activate this feature
404Fine-tuning task does not existEnsure the fine-tuning task ID is correct
429Interface request concurrency exceededAdjust the request frequency or contact business to increase concurrency
429File upload frequency too fastWait briefly and then request again
429Account balance exhaustedRecharge the account to ensure sufficient balance
429Account anomalyAccount has violation, please contact platform customer service to unlock
429Terminal account anomalyTerminal user has violation, account has been locked
434No API permission, fine-tuning API and file management API are in beta phase, we will open soonWait for the interface to be officially open or contact platform customer service to apply for beta
435File size exceeds 100MBUse a jsonl file smaller than 100MB or upload in batches
500Server error occurred while processing the requestTry again later or contact customer service

Business Error Codes

Error CategoryCodeError Message
Basic Error500Internal Error
Authentication Error1000Authentication Failed
1001Authentication parameter not received in Header, unable to authenticate
1002Invalid Authentication Token, please confirm the correct transmission of the Authentication Token
1003Authentication Token expired, please regenerate/obtain
1004Authentication failed with the provided Authentication Token
1100Account Read/Write
Account Error1110Your account is currently inactive. Please check your account information
1111Your account does not exist
1112Your account has been locked, please contact customer service to unlock
1113Your account is in arrears, please recharge and try again
1120Unable to successfully access your account, please try again later
API Call Error1200API Call Error
1210Incorrect API call parameters, please check the documentation
1211Model does not exist, please check the model code
1212Current model does not support ${method} call method
1213${field} parameter not received properly
1214Invalid ${field} parameter. Please check the documentation
1215${field1} and ${field2} cannot be set simultaneously, please check the documentation
1220You do not have permission to access ${API_name}
1221API ${API_name} has been taken offline
1222API ${API_name} does not exist
1230API call process error
1231You already have a request: ${request_id}
1234Network error, error id: ${error_id}, please contact customer service
API Policy Block Error1300API call blocked by policy
1301System detected potentially unsafe or sensitive content in input or generation. Please avoid using prompts that may generate sensitive content. Thank you for your cooperation.
1302High concurrency usage of this API, please reduce concurrency or contact customer service to increase limits
1303High frequency usage of this API, please reduce frequency or contact customer service to increase limits
1304Daily call limit for this API reached. For more requests, please contact customer service to purchase

Error Shapes

Errors are always returned as JSON, with a top-level error object that includes a code and message value.
{
  "error": {
    "code": "1214",
    "message": "Input cannot be empty"
  }
}

Error Example

The following is the response message of a curl request, where 401 is the HTTP status code and 1002 is the business error code.
* We are completely uploaded and fine
< HTTP/2 401
< date: Wed, 20 Mar 2024 03:06:05 GMT
< content-type: application/json
< set-cookie: acw_tc=76b20****a0e42;path=/;HttpOnly;Max-Age=1800
< server: nginx/1.21.6
< vary: Origin
< vary: Access-Control-Request-Method
< vary: Access-Control-Request-Headers
<
* Connection #0 to host open.z.ai left intact
{"error":{"code":"1002","message":"Authorization Token is invalid, please ensure that the Authorization Token is correctly provided."}}
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.