Notebook
查询模型镜像列表
1.接口说明
接口路径:/ai/openapi/v2/image/models
请求方式:POST
请求数据类型:
接口描述:查询镜像列表
2.请求消息
请求参数:
Headers:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
参数:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| page | string | 否 | 分页 | 1 |
| size | string | 否 | 分页大小 | 1 |
| acceleratorType | string | 否 | 加速器类型 | dcu |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/ai/openapi/v2/image/models' \
--header 'token: <Token>' \
--header 'Content-Type: application/json' \
--data '{
"page":1,
"size":1
}'Java请求示例
java
import okhttp3.*;
public class GetModelImagesListDemo {
public static final String TOKEN = "<Token>";
public static final String URL = "https://scnet-demo.accloud.cn/ai/openapi/v2/image/models";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n" +
" \"page\": 1,\n" +
" \"size\": 1\n" +
"}");
Request request = new Request.Builder()
.url(URL)
.method("POST", body)
.addHeader("token", TOKEN)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Python请求示例
python
import requests
import json
url = "https://scnet-demo.accloud.cn/ai/openapi/v2/image/models"
payload = json.dumps({
"page": 1,
"size": 1
})
headers = {
"token": "<Token>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)4.响应消息
返回参数:
| 名称 | 类型 | 描述 | 示例 |
|---|---|---|---|
| msg | string | 信息 | success |
| code | string | 状态码 | 0 |
| data | array | 镜像列表 | |
| id | string | id | 64533e2d89fc4b6cb343fcd30a541bb2 |
| imageId | string | 镜像层id | sha256:b60cfe03b8c5cde83c6358f752b93d8b97f1e3eef47aebf2a098911c194493d9 |
| tag | string | 标签 | torch2.2.0-py3.10-cuda12.1-model |
| description | string | 镜像描述 | 带 WebUI 的图像生成开箱即用工具,能够生成几乎任何艺术风格的高质量图像,是用来生成写实图像的最佳开放模型 |
| createTime | string | 创建时间 | 2024-06-23 00:00:00 |
| acceleratorType | string | 加速器类型 | gpu |
| path | string | 镜像路径 | image.ac.com:5000/gpu/admin/base/jupyterlab-stable-diffusion-normal-webui:torch2.2.0-py3.10-cuda12.1-model |
| version | string | 镜像版本 | jupyterlab-stable-diffusion-normal-webui:torch2.2.0-py3.10-cuda12.1-model |
| status | string | 镜像状态 | Completed |
| imageSize | string | 加速器类型 | 16535832917 |
返回示例:
json
{
"code": "0",
"msg": "success",
"data": {
"records": [
{
"id": "64533e2d89fc4b6cb343fcd30a541bb2",
"imageId": "sha256:b60cfe03b8c5cde83c6358f752b93d8b97f1e3eef47aebf2a098911c194493d9",
"tag": "torch2.2.0-py3.10-cuda12.1-model",
"description": "带 WebUI 的图像生成开箱即用工具,能够生成几乎任何艺术风格的高质量图像,是用来生成写实图像的最佳开放模型",
"createTime": "2024-06-23 00:00:00",
"acceleratorType": "gpu",
"path": "image.ac.com:5000/gpu/admin/base/jupyterlab-stable-diffusion-normal-webui:torch2.2.0-py3.10-cuda12.1-model",
"version": "jupyterlab-stable-diffusion-normal-webui:torch2.2.0-py3.10-cuda12.1-model",
"status": "Completed",
"imageSize": "16535832917"
}
],
"total": 192
}
}5.错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 内部错误 |
| 10003 | 参数不全 |
| 10004 | 参数无效 |
| 10007 | 用户已被冻结 |
| 10008 | 权限不足 |
| 10009 | 没有权限访问接口 |
| 10010 | 文件校验失败 |
| 10011 | 文件过大 |
| 10012 | 连接中断 |