API请求
URLs
POST zstack/v1/ai/modelsHeaders
Authorization: OAuth the-session-uuidBody
{
"param": {
"name": "Qwen 1.5 32B",
"installPath": "192.168.10.12:/ai/model_center/Qwen_1.5_23B",
"description": "This is qwen 1.5 32B ai model",
"parameters": "model parameters",
"modelCenterUuid": "uuid",
"logo": "logo base64 string",
"vendor": "Alibaba",
"introduction": "This is a md5 format string",
"size": 102400,
"version": "CustomizeVersion"
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"param":{"name":"Qwen 1.5 32B","installPath":"192.168.10.12:/ai/model_center/Qwen_1.5_23B","description":"This is qwen 1.5 32B ai model","parameters":"model parameters","modelCenterUuid":"uuid","logo":"logo base64 string","vendor":"Alibaba","introduction":"This is a md5 format string","size":102400,"version":"CustomizeVersion"}}' http://localhost:8080/zstack/v1/ai/models参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在param结构中) | 资源名称 | 5.1.8 | |
| installPath | String | body(包含在param结构中) | 模型安装路径 | 5.1.8 | |
| description (可选) | String | body(包含在param结构中) | 资源的详细描述 | 5.1.8 | |
| parameters (可选) | String | body(包含在param结构中) | 模型的详细参数 | 5.1.8 | |
| modelCenterUuid | String | body(包含在param结构中) | 模型中心的UUID | 5.1.8 | |
| systemTags (可选) | List | body | 系统标签 | 5.1.8 | |
| userTags (可选) | List | body | 用户标签 | 5.1.8 | |
| logo (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| vendor (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| introduction (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| size (可选) | Long | body(包含在param结构中) | 5.1.8 | ||
| version (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| token (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| resourceUuid (可选) | String | body(包含在param结构中) | 资源UUID | 5.1.8 | |
| tagUuids (可选) | List | body(包含在param结构中) | 标签UUID列表 | 5.1.8 | |
| modelServiceUuids (可选) | List | body(包含在param结构中) | 5.2.1 | ||
| recommendedGpuNum (可选) | String | body(包含在param结构中) | 5.4.6 | ||
| gpuConstraintDescription (可选) | String | body(包含在param结构中) | 5.4.6 | ||
| modelId (可选) | String | body(包含在param结构中) | 5.5.6 | ||
| shareMode (可选) | String | body(包含在param结构中) | 共享模式 | Public | 5.5.12 |
| defaultModelServiceUuid (可选) | String | body(包含在param结构中) | 默认模型服务UUID | 5.5.22 |
API返回
返回示例
{
"inventory": {
"description": "",
"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
AddModelAction action = new AddModelAction();
action.name = "Qwen 1.5 32B";
action.installPath = "192.168.10.12:/ai/model_center/Qwen_1.5_23B";
action.description = "This is qwen 1.5 32B ai model";
action.parameters = "model parameters";
action.modelCenterUuid = "uuid";
action.logo = "logo base64 string";
action.vendor = "Alibaba";
action.introduction = "This is a md5 format string";
action.size = 102400;
action.version = "CustomizeVersion";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddModelAction.Result res = action.call();Python SDK
AddModelAction action = AddModelAction()
action.name = "Qwen 1.5 32B"
action.installPath = "192.168.10.12:/ai/model_center/Qwen_1.5_23B"
action.description = "This is qwen 1.5 32B ai model"
action.parameters = "model parameters"
action.modelCenterUuid = "uuid"
action.logo = "logo base64 string"
action.vendor = "Alibaba"
action.introduction = "This is a md5 format string"
action.size = 102400
action.version = "CustomizeVersion"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddModelAction.Result res = action.call()