获取服务列表
更新时间:2024-03-28
功能介绍
本接口用于根据服务类型获取服务列表,如服务类型为chat类型,可以获取所有chat类型的服务列表。
注意事项
调用本文API,使用“安全认证/Access Key ”中的Access Key ID 和 Secret Access Key等进行鉴权,无法使用获取Access Token的方式鉴权,具体鉴权认证机制参考鉴权认证机制。
请求说明
基本信息
请求地址: https://qianfan.baidubce.com/wenxinworkshop/service/list
请求方式: POST
Header参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Content-Type | string | 是 | 固定值:application/json |
x-bce-date | string | 否 | 当前时间,遵循ISO8601规范,格式如2016-04-06T08:23:49Z |
Authorization | string | 是 | 用于验证请求合法性的认证信息,更多内容请参考鉴权认证机制,签名工具可参考IAM签名工具 |
Body参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
apiTypefilter | array | 否 | 根据服务类型apiType筛选,可选值如下: · chat · completions · embeddings · text2image · image2text |
响应说明
名称 | 类型 | 描述 |
---|---|---|
log_id | string | 请求ID |
result | object | 请求结果 |
result说明
名称 | 类型 | 描述 |
---|---|---|
common | array(serviceItem) | 预置服务 |
custom | array(serviceItem) | 自定义服务 |
serviceItem说明
名称 | 类型 | 描述 |
---|---|---|
serviceId | int | 服务id |
serviceUuid | string | 服务uuid |
name | string | 服务名称 |
url | string | 服务endpoint |
apiType | string | 服务类型,说明: · chat · completions · embeddings · text2image · image2text |
chargeStatus | string | 付费状态,说明: · NOTOPEN · OPENED · STOP · FREE |
versionList | array(version) | 服务版本列表 |
version说明
名称 | 类型 | 描述 |
---|---|---|
aiModelId | string | 发布该服务版本的模型id,只有自定义服务会返回该字段 |
aiModelVersionId | string | 发布该服务版本的模型版本id,只有自定义服务会返回该字段 |
trainType | string | 服务基础模型类型 |
serviceStatus | string | 服务状态,说明 (1)该字段值对应状态说明: · Done:已发布 · New:待发布 · Deploying:发布中 · Failed:发布失败 · Stopped:暂停服务 (2)如果是预置服务,该字段为固定值Done |
示例
请求示例
curl --location 'https://qianfan.baidubce.com/wenxinworkshop/service/list' \
--header 'Authorization: bce-auth-v1/047ab241bad24166b42a4d2e3e28b1ac/2023-10-10T07:48:39Z/1800/host;x-bce-date/c26e0a21944cc53773f3e7ec48affb9d7b9565ce6d627e77329ee2f2d10cb53f' \
--header 'x-bce-date: 2023-10-10T07:48:17Z' \
--header 'Content-Type: application/json' \
--data '{"apiTypefilter":["chat", "completions", "embeddings", "text2image"]}'
响应示例
{
"log_id": "4102908182"
"success": true,
"result": {
// 预置服务
"common": [{
"name": "ERNIE-Bot 4.0",
"url": "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro",
"apiType": "chat",
"chargeStatus": "OPENED",
"versionList": [{
"trainType": "ernieBot_4",
"serviceStatus": "Done" // 服务状态,已发布
}]
}],
// 自定义服务
"custom": [{
"serviceId":"123", // 服务id
"serviceUuid":"svco-xxxxaaa", // 服务id
"name": "conductor_liana2",
"url": "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ca6zisxxxx",
"apiType": "chat",
"chargeStatus": "NOTOPEN",
"versionList": [{
"aiModelId":"xxx-123", // 发布该服务的模型id
"aiModelVersionId":"xxx-456", // 发布该服务的模型版本id
"trainType": "llama2-7b",
"serviceStatus": "Done" // 服务状态,已发布
}]
}]
}
}
错误码
若请求错误,服务器将返回的JSON文本包含以下参数:
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
例如参数错误返回:
{
"error_code": 500001,
"error_msg": "param invalid"
}
更多千帆大模型平台其他错误码,也可以查看错误码说明。