基本信息

Action:/qai/aicp/notebooks/namespaces/{namespace}/create

Method: POST

Content-Type:application/json

请求参数

参数 类型 描述 是否必须

charge_mode

string

计费模式,弹性按需计费(elastic)或者包年包月(monthly)

yes

duration

integer

购买时长,弹性按需计费为 3600,包年包月需指定月数(1-60)

yes

auto_renew

integer

自动续费标识 (0为不自动续费,1 为自动续费)

no

next_charge_mode

string

下次计费模式,用于变更计费模式 (elastic/monthly)

no

user_id

string

用户 ID

yes

root_user_id

string

Root 用户 ID

no

namespace

string

命名空间

yes

image

string

镜像名称或地址

yes

image_type

string

镜像类型,如 official,user 或 custom

yes

name

string

实例名称

yes

server_type

string

服务器类型,如 jupyter,code_server,rstudio

yes

envs

array<object>

环境变量配置数组

no

stop_time

string(date-time)

计划停止时间

no

auto_delete_time

string(date-time)

自动删除时间

no

replica_specs

object

副本配置列表

yes

replica_specs.replicas

integer

副本数量,默认为 1

yes

replica_specs.specs

string

规格配置 ID, 从 boss 产品中心的 sku_id,或者节点 id, 如果为节点 id 的情况下必选传入 rg_id。

no

replica_specs.replica_type

string

副本类型,如

  • Tfjobs : Master, Worker, PS, Chief, Evalator

  • Pytorchjobs : Master, Worker, PS, Chief, Evalator

  • MPIjobs : Master, Worker, PS, Chief, Evalator

  • Notebook : Master

no

replica_specs.rg_id

string

资源组 ID

no

replica_specs.custom_cpu

integer

自定义 CPU 核数

no

replica_specs.custom_memory

integer

自定义内存大小

no

replica_specs.custom_gpu

integer

自定义 GPU 数量

no

replica_specs.custom_gpu_list

array<string>

自定义 GPU 列表 (唯一值)

no

replica_specs.custom_gpu_name

string

自定义 GPU 名称

no

replica_specs.custom_gpu_memory

string

自定义 GPU 内存

no

replica_specs.custom_gpu_type

string

自定义 GPU 类型

no

replica_specs.custom_system_disk_size

integer

自定义系统盘大小

no

replica_specs.custom_data_disk_size

integer

自定义数据盘大小

no

replica_specs.custom_infiniband

integer

是否支持 InfiniBand

no

replica_specs.custom_aipods_type

string

自定义 AIPods 类型

no

replica_specs.custom_hashrate_allocation

integer

自定义算力分配

no

replica_specs.custom_network_description

string

自定义网络描述

no

replica_specs.custom_cpu_model

string

自定义 CPU 型号

no

replica_specs.custom_cpu_manufacturer

string

自定义 CPU 制造商

no

replica_specs.template_id

integer

模板ID

no

volume_specs

array<object>

挂载配置列表

no

volume_specs.file_set

string

文件集名称

yes

volume_specs.mount_path

string

挂载路径

yes

volume_specs.volume_type

string

挂载类型

yes

volume_specs.file_type

string

文件类型 (Directory/File)

no (默认 Directory)

volume_specs.quota

integer

配额大小

no (默认 0)

volume_specs.permission

string

权限 (rw/ro)

no (默认 rw)

volume_specs.owner

string

存储拥有者

no

custom_image_secret

object

自定义镜像仓库认证信息

no

custom_image_secret.has_auth

boolean

是否有认证

no

custom_image_secret.username

string

用户名

若 has_auth=true 则 yes

custom_image_secret.password

string

密码

若 has_auth=true 则 yes

pip

string

pip 配置

no

conda

string

conda 配置

no

apt

string

apt 配置

no

custom_first

string

自定义第一优先级配置, 9001 协议

no

custom_second

string

自定义第二优先级配置,9002 协议

no

响应参数

此接口包含的公共响应参数,可参见前文内容,其他参数说明如下:

参数 类型 说明

data

array<object>

核心数据数组

data.user_name

string

用户名

data.email

string

用户电子邮箱

data.kuid

string

用户唯一标识 (UUID 格式)

data.status

string

实例当前状态

data.reason

string

状态变更原因说明

data.user_id

string

用户ID

data.root_user_id

string

根用户 ID(主账号)

data.created_at

string(date-time)

创建时间

data.updated_at

string(date-time)

最后更新时间

data.namespace

string

资源所属命名空间

data.image

string

使用的镜像名称或地址

data.image_type

string

镜像类型标识

data.name

string

实例名称

data.server_type

string

服务器类型

data.envs

array<object>

环境变量配置数组

data.stop_time

string(date-time)

计划停止时间

data.auto_delete_time

string(date-time)

自动删除时间

data.uuid

string(≤36字符)

实例唯一标识符

data.server

string

服务器连接信息

data.pip

string

pip 包管理配置

data.conda

string

conda 环境配置

data.apt

string

apt 软件包配置

data.ws_url

string

WebSocket 服务地址

data.volume_specs

array<object>

存储卷挂载配置

data.volume_specs.id

integer

存储卷配置 ID

data.volume_specs.file_set

string

文件集名称

data.volume_specs.mount_path

string

容器内挂载路径

data.volume_specs.volume_type

string

存储类型

data.volume_specs.file_type

string

文件类型 (Directory/File)

data.volume_specs.quota

integer

存储配额

data.volume_specs.permission

string

访问权限 (rw/ro)

data.volume_specs.owner

string

存储卷所有者

data.volume_specs.pvc_name

string

PVC 名称

data.volume_specs.notebook_uuid

string

关联的实例 UUID

data.replica_specs

object

副本规格配置

data.replica_specs.id

integer

配置记录 ID

data.replica_specs.replicas

integer

副本数量

data.replica_specs.specs

string

规格描述文本

data.replica_specs.replica_type

string

副本类型标识

data.replica_specs.rg_id

string

资源组ID

data.replica_specs.custom_cpu

integer

自定义 CPU 核数

data.replica_specs.custom_memory

integer

自定义内存

data.replica_specs.custom_gpu

integer

GPU 卡数量

data.replica_specs.custom_gpu_list

array<string>

分配的 GPU 设备 ID 列表

data.replica_specs.custom_gpu_name

string

GPU 型号名称

data.replica_specs.custom_gpu_memory

string

GPU 显存大小

data.replica_specs.custom_gpu_type

string

GPU 类型标识

data.replica_specs.custom_system_disk_size

integer

系统盘大小

data.replica_specs.custom_data_disk_size

integer

数据盘大小

data.replica_specs.custom_infiniband

integer

是否启用InfiniBand (0/1)

data.replica_specs.custom_aipods_type

string

AI 加速器类型

data.replica_specs.custom_hashrate_allocation

integer

算力分配值

data.replica_specs.custom_network_description

string

网络配置描述

data.replica_specs.custom_cpu_model

string

CPU具体型号

data.replica_specs.custom_cpu_manufacturer

string

CPU 制造商

data.replica_specs.notebook_uuid

string

关联的实例 UUID

data.servers

array<object>

服务器实例详情

data.pod_ips

array<any>

Pod 的 IP 地址列表

data.running_time

number(time-delta)

累计运行时长 (秒)

请求示例

curl -X 'POST' \
  'https://ai.coreshub.cn/qai/aicp/notebooks/namespaces/usr-5HY8cxxx/create' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "volume_specs": [
    {
      "volume_type": "GPFS",
      "file_set": "ddeddfgsfveafewsf",
      "mount_path": "/root/epfs"
    }
  ],
  "envs": ,
  "image_type": "official",
  "image": "public/tverous:pytorch-notebook",
  "replica_specs": {
    "replicas": 1,
    "replica_type": "Worker",
    "specs": "sku_7Q5Q7yNLJZoA"
  },
  "service": "qai",
  "namespace": "usr-wj2gdxug",
  "action": "notebooks/namespaces/usr-wj2gdxug/create",
  "zone": "jinan1",
  "owner": "usr-WJ2gdXUg",
  "user_id": "usr-WJ2gdXUg"
}'

响应示例

{
    "message": "success",
    "meta": {
        "X_REQUEST_ID": "7faebd93",
        "X_REQUEST_USER": "usr-5HY8xxxx"
    },
    "data": [
        {
            "image": "xb3-dockerhub.coreshub.cn/aicp/public/tensorflow:2.16.1-gpu-jupyter",
            "updated_at": "2025-04-15T10:04:05",
            "apt": "ubuntu",
            "servers": [
                {
                    "status": false,
                    "protocol": "http",
                    "server_name": "jupyter",
                    "server_type": "jupyter",
                    "url": "http://ai.coreshub.cn/xb3a/notebook/jupyter/usr-5hy8xxxx/nb-eixykhj8ay9s/",
                    "target_port": 8888,
                    "password": null
                },
                {
                    "status": false,
                    "protocol": "http",
                    "server_name": "vscode",
                    "server_type": "vscode",
                    "url": "http://ai.coreshub.cn/xb3a/notebook/coder/usr-5hy8xxxx/nb-eixykhj8ay9s/",
                    "target_port": 8889,
                    "password": null
                }
            ],
            "pip": "pypi",
            "pod_ips": null,
            "volume_specs": [],
            "user_id": "usr-5HY8xxxx",
            "uuid": "nb-eixykhj8ay9s",
            "image_type": "official",
            "namespace": "usr-5hy8xxxx",
            "stop_time": null,
            "user_name": "",
            "email": "",
            "kuid": null,
            "status": "Pending",
            "replica_specs": {
                "custom_system_disk_size": 30,
                "custom_gpu_memory": "",
                "custom_gpu_name": "",
                "custom_aipods_type": "only_gpu-xb3-1",
                "custom_cpu_manufacturer": "amd",
                "rg_id": null,
                "replica_type": "Worker",
                "custom_cpu": 1,
                "custom_infiniband": 0,
                "notebook_uuid": "nb-eixykhj8ay9s",
                "replicas": 1,
                "custom_gpu": 0,
                "id": 2754,
                "custom_gpu_type": "",
                "custom_data_disk_size": 0,
                "custom_network_description": "",
                "custom_cpu_model": "AMD",
                "custom_memory": 2,
                "custom_gpu_list": null,
                "specs": "sku_pmvBGy0J002N",
                "custom_hashrate_allocation": 0
            },
            "server_type": "jupyter",
            "reason": null,
            "conda": "conda",
            "ws_url": "/aicp/kapi/v1/ws/namespaces/usr-5hy8xxxx/pods/nb-eixykhj8ay9s-0/container/nb-eixykhj8ay9s/exec",
            "auto_delete_time": null,
            "running_time": 0.388821,
            "name": "docs-01",
            "created_at": "2025-04-15T10:04:05",
            "server": null,
            "envs": [],
            "root_user_id": ""
        }
    ],
    "counts": 0,
    "ret_code": 0
}