文档

返回状态码说明

更新时间:

状态码参考

DashScope灵积模型服务的API调用将返回状态码以标识调用结果。通用状态码由DashScope约定,各算法模型还可能在通用状态码的基础上增加自定义的状态码和状态信息。请通过返回结果中的 code status 字段定位调用成功或失败的详细信息。

下表列出DashScope通用状态码信息。各算法模型自定义的状态码信息则可在模型详情页进行查找。

重要

通义千问模型API目前处于"申请体验"阶段,请点击此处申请。

在您的账号未申请体验或申请未通过时,调用通义千问模型API将返回错误状态码。

Code

Status

可能的原因

含义说明

400

InvalidParameter

Required parameter(s) missing or invalid, please check the request parameters.(可根据实际情况修改)

接口调用参数不合法

429

Throttling

Requests throttling triggered.

接口调用触发限流

429

Throttling.RateQuota

Requests rate limit exceeded, please try again later.

调用频次触发限流,比如 QPM

429

Throttling.AllocationQuota

Allocated quota exceeded, please increase your quota limit.

一段时间调用量触发限流,比如 TPM

500

InternalError

An internal error has occured, please try again later or contact service support.(可根据实际情况修改)

内部错误

500

InternalError.Algo

An internal error has occured during execution, please try again later or contact service support.(可根据实际情况修改)

内部算法错误

400

DataInspectionFailed

Input or output data may contain sensitive content.

数据检查错误,输入或者输出包含疑似敏感内容被绿网拦截

400

BadRequest.EmptyInput

Required input parameter missing from request.

请求的输入不能为空

400

BadRequest.EmptyParameters

Required parameter "parameters" missing from request.

请求的参数不能为空

400

BadRequest.EmptyModel

Required parameter "model" missing from request.

请求输入的模型不能为空

500

SystemError

An system error has occured, please try again later.

系统错误

401

InvalidApiKey

Invalid API-key provided.

请求中的 ApiKey 错误

408

RequestTimeOut

Request timed out, please try again later.

请求超时

400

InvalidURL

Invalid URL provided in your request.

请求的 URL 错误

400

AccessDenied

Access denied.

无权访问此 API,比如不在邀测中

400

AccessDenied.Unpurchased

Access to model denied. Please make sure you are eligible for using the model.

客户没有开通此商品

400

Arrearage

Access denied, plesase make sure your account is in good standing.

客户账户因为欠费而访问被拒绝

413

BadRequest.TooLarge

Payload Too Large

接入层网关返回请求体过大错误,错误如果是由mse网关层直接拦截,则没有 code,并且 message 不能自定义。如果是restful网关拦截返回code。

500

InternalError.Timeout

An internal timeout error has occured during execution, please try again later or contact service support.

异步任务从网关提交给算法服务层之后等待时间 3 小时,如果 3 小时始终没有结果,则超时。

400

UnsupportedOperation

The operation is unsupported on the referee object.

关联的对象不支持该操作(可以根据实际情况修改)

注:http 返回码在某些特定协议之下可能不存在

返回字段参考

DashScope灵积模型服务除状态码外还会返回请求的一些细节信息。一个示例的调用可能如下所示:

{
  "status_code": 200,
  "request_id": "54dc32fd-968b-4aed-b6a8-ae63d6fda4d4",
  "output": {
    "text": "这是一个示例。"
  },
  "code": "",
  "message": "",
  "usage": {
  	"computation_time": 1230,
    "input_tokens": 7,
    "output_tokens": 78
  }
}

  • 返回参数说明

返回参数

类型

说明

status_code

int

200(HTTPStatus.OK)表示请求成功,否则表示请求失败,可以通过code获取错误码,通过message字段获取错误详细信息。

request_id

string

系统对一次API调用赋予的唯一标识。当排查问题的时候,开发者可以将 request_id 进行反馈以定位某次调用。

output

object

调用API指定的算法模型所返回的AI处理输出。

usage

object

调用API后模型服务产生的计量数据。

code

string

如果失败表示错误码,参考错误码表。

message

string

如果失败,内容为失败详细信息。

  • 本页导读 (0)
文档反馈