API请求
URLs
GET zstack/v1/ai/modelsGET zstack/v1/ai/models/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/ai/models?q=274fec2ef4bc4815a6544d1ee27d7899curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/ai/models/c2ad36349f653325ab482b77156fe952可查询字段
运行zstack-cli命令行工具,输入QueryModel并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "uuid",
"name": "qwen 1.5 32B",
"description": "This is an example ai model",
"installPath": "192.168.10.10:/ai/model_center/qwen_1.5_32B",
"modelCenterUuid": "model center uuid",
"extraGpuMemRequest": 2147483648,
"SAMPLE_SIZE": 1000
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 5.1.8 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.1.8 |
| inventories | List | 详情参考inventories | 5.1.8 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.1.8 |
| description | String | 错误的概要描述 | 5.1.8 |
| details | String | 错误的详细信息 | 5.1.8 |
| elaboration | String | 保留字段,默认为null | 5.1.8 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.1.8 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.1.8 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标识该资源 | 5.1.8 |
| name | String | 资源名称 | 5.1.8 |
| description | String | 资源的详细描述 | 5.1.8 |
| installPath | String | 模型的安装路径 | 5.1.8 |
| parameters | String | 模型的详细参数 | 5.1.8 |
| modelCenterUuid | String | 模型中心UUID | 5.1.8 |
| logo | String | 模型Logo | 5.1.8 |
| vendor | String | 模型供应商 | 5.1.8 |
| modelId | String | 模型ID | 5.1.8 |
| introduction | String | 模型介绍 | 5.1.8 |
| size | Long | 模型大小 | 5.1.8 |
| version | String | 模型版本 | 5.1.8 |
| type | String | 模型类型 | 5.1.8 |
| minGpuMemory | Long | 最低GPU显存 | 5.1.8 |
| recommendedGpuMemory | Long | 推荐GPU显存 | 5.1.8 |
| recommendedGpuNum | List | 推荐GPU数量 | 5.1.8 |
| gpuConstraintDescription | String | GPU约束说明 | 5.1.8 |
| versionSemver | String | 语义化版本 | 5.1.8 |
| isLatestVersion | Boolean | 是否为最新版本 | 5.1.8 |
| artifactChecksum | String | 制品校验和 | 5.1.8 |
| artifactSizeBytes | Long | 制品大小,单位为字节 | 5.1.8 |
| architectureType | String | 模型架构类型 | 5.1.8 |
| frameworkVersion | String | 框架版本 | 5.1.8 |
| requiredAccelerator | String | 所需加速器 | 5.1.8 |
| pipelineTag | String | 流水线标签 | 5.1.8 |
| modelServiceRefs | List | 模型与模型服务的绑定关系 | 5.1.8 |
| extraGpuMemRequest | Long | 额外GPU显存需求 | 5.1.8 |
| SAMPLE_SIZE | Integer | 采样大小 | 5.1.8 |
| createDate | Timestamp | 创建时间 | 5.1.8 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.1.8 |
SDK示例
Java
SDK
QueryModelAction action = new QueryModelAction();
action.conditions = asList("29203806c58541ce9c4292f866a54835");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryModelAction.Result res = action.call();Python
SDK
QueryModelAction action = QueryModelAction()
action.conditions = ["04c117a60af1492390e9f6006ab7d9d4"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryModelAction.Result res = action.call()