API请求
URLs
PUT zstack/v1/ai/models/{uuid}Headers
Authorization: OAuth the-session-uuidBody
{
"updateModel": {
"name": "example",
"vendor": "Alibaba"
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateModel":{"name":"example","vendor":"Alibaba"}}' http://localhost:8080/zstack/v1/ai/models/059d19eb310f36d4a7f43f51eaab87b8参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 5.1.8 | |
| name (可选) | String | body(包含在updateModel结构中) | 资源名称 | 5.1.8 | |
| installPath (可选) | String | body(包含在updateModel结构中) | 模型存储的url | 5.1.8 | |
| description (可选) | String | body(包含在updateModel结构中) | 资源的详细描述 | 5.1.8 | |
| vendor (可选) | String | body(包含在updateModel结构中) | 5.5.6 | ||
| parameters (可选) | String | body(包含在updateModel结构中) | 模型的详细参数 | 5.1.8 | |
| modelCenterUuid (可选) | String | body(包含在updateModel结构中) | 模型中心的UUID | 5.1.8 | |
| systemTags (可选) | List | body | 系统标签 | 5.1.8 | |
| userTags (可选) | List | body | 用户标签 | 5.1.8 | |
| modelClassifications (可选) | List | body(包含在updateModel结构中) | 5.4.6 | ||
| recommendedGpuNum (可选) | String | body(包含在updateModel结构中) | 5.4.6 | ||
| gpuConstraintDescription (可选) | String | body(包含在updateModel结构中) | 5.4.6 | ||
| modelId (可选) | String | body(包含在updateModel结构中) | 模型ID。 | 5.5.22 | |
| defaultModelServiceUuid (可选) | String | body(包含在updateModel结构中) | 默认模型服务UUID。 | 5.5.22 | |
| clearDefaultModelService (可选) | Boolean | body(包含在updateModel结构中) | 是否清除默认模型服务。 | 5.5.22 |
API返回
返回示例
{
"inventory": {
"uuid": "1bb3ef7d600d4d30b21b8ffd299c37b5",
"name": "example",
"description": "test model",
"installPath": "/usr/local/test-model",
"parameters": "test parameters",
"modelCenterUuid": "ebf96ce1de2c46fa8af9d503c29bb93d",
"logo": "BASE64data",
"vendor": "ZStack",
"modelId": "test-model-id",
"introduction": "This is a md5 format string",
"size": 1024000,
"version": "CustomizeVersion",
"type": "System",
"minGpuMemory": 4295991296,
"recommendedGpuMemory": 4295991296,
"versionSemver": "1.0.0",
"isLatestVersion": true,
"artifactChecksum": "This is a sha256 format string",
"artifactSizeBytes": 1024000,
"architectureType": "Qwen3MoeForCausalLM",
"frameworkVersion": "PyTorch 2.0.1+cu118",
"requiredAccelerator": "cuda:12.1",
"extraGpuMemRequest": 4294967296,
"SAMPLE_SIZE": 1000
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| 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
UpdateModelAction action = new UpdateModelAction();
action.uuid = "059d19eb310f36d4a7f43f51eaab87b8";
action.name = "example";
action.vendor = "Alibaba";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateModelAction.Result res = action.call();Python SDK
UpdateModelAction action = UpdateModelAction()
action.uuid = "059d19eb310f36d4a7f43f51eaab87b8"
action.name = "example"
action.vendor = "Alibaba"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateModelAction.Result res = action.call()