跳转到主要内容
POST
/
gpu-instance
/
openapi
/
v1
/
gpu
/
instance
/
create
创建 CPU 实例
curl --request POST \
  --url https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "name": "<string>",
  "productId": "<string>",
  "imageUrl": "<string>",
  "imageAuth": "<string>",
  "imageAuthId": "<string>",
  "ports": "<string>",
  "envs": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ],
  "tools": [
    {
      "name": "<string>",
      "port": "<string>",
      "type": "<string>"
    }
  ],
  "command": "<string>",
  "entrypoint": "<string>",
  "clusterId": "<string>",
  "localStorageMountPoint": "<string>",
  "networkStorages": [
    {
      "Id": "<string>",
      "mountPoint": "<string>"
    }
  ],
  "networkId": "<string>",
  "kind": "<string>"
}
'
import requests

url = "https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create"

payload = {
"name": "<string>",
"productId": "<string>",
"imageUrl": "<string>",
"imageAuth": "<string>",
"imageAuthId": "<string>",
"ports": "<string>",
"envs": [
{
"key": "<string>",
"value": "<string>"
}
],
"tools": [
{
"name": "<string>",
"port": "<string>",
"type": "<string>"
}
],
"command": "<string>",
"entrypoint": "<string>",
"clusterId": "<string>",
"localStorageMountPoint": "<string>",
"networkStorages": [
{
"Id": "<string>",
"mountPoint": "<string>"
}
],
"networkId": "<string>",
"kind": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
name: '<string>',
productId: '<string>',
imageUrl: '<string>',
imageAuth: '<string>',
imageAuthId: '<string>',
ports: '<string>',
envs: [{key: '<string>', value: '<string>'}],
tools: [{name: '<string>', port: '<string>', type: '<string>'}],
command: '<string>',
entrypoint: '<string>',
clusterId: '<string>',
localStorageMountPoint: '<string>',
networkStorages: [{Id: '<string>', mountPoint: '<string>'}],
networkId: '<string>',
kind: '<string>'
})
};

fetch('https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'productId' => '<string>',
'imageUrl' => '<string>',
'imageAuth' => '<string>',
'imageAuthId' => '<string>',
'ports' => '<string>',
'envs' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'tools' => [
[
'name' => '<string>',
'port' => '<string>',
'type' => '<string>'
]
],
'command' => '<string>',
'entrypoint' => '<string>',
'clusterId' => '<string>',
'localStorageMountPoint' => '<string>',
'networkStorages' => [
[
'Id' => '<string>',
'mountPoint' => '<string>'
]
],
'networkId' => '<string>',
'kind' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"imageAuthId\": \"<string>\",\n \"ports\": \"<string>\",\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"port\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"command\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"clusterId\": \"<string>\",\n \"localStorageMountPoint\": \"<string>\",\n \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"imageAuthId\": \"<string>\",\n \"ports\": \"<string>\",\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"port\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"command\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"clusterId\": \"<string>\",\n \"localStorageMountPoint\": \"<string>\",\n \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"imageAuthId\": \"<string>\",\n \"ports\": \"<string>\",\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"port\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"command\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"clusterId\": \"<string>\",\n \"localStorageMountPoint\": \"<string>\",\n \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>"
}

请求头

Content-Type
string
必填
枚举值:application/json。
Authorization
string
必填
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。

请求体

name
string
CPU 实例名称。字符串,长度限制:0-255 字符。
productId
string
必填
用于部署实例的产品 ID。可以调用获取 CPU 产品列表接口查询。字符串,长度限制:1-255 字符。
imageUrl
string
必填
容器镜像地址。字符串,长度限制:1-500 字符。
imageAuth
string
镜像仓库认证。格式为 username:password。使用私有镜像时需配置,使用公共镜像或派欧云平台的镜像时,无需配置。字符串,长度限制:0-10239 字符。
imageAuthId
string
镜像仓库认证 ID。
ports
string
实例对外开放的端口。字符串,示例:80/http, 3306/tcp。支持的端口号范围:1-65535,其中 2222、2223、2224 为内部端口,不可使用。支持的端口类型为 tcp、http。ports + tools 最多使用 15 个端口。
envs
object[]
实例环境变量。数组,最多 100 组环境变量。
tools
object[]
是否开启官方镜像支持工具。数组,目前部分官方镜像仅包含 Jupyter。ports + tools 最多使用 15 个端口。
command
string
容器启动命令。该配置会覆盖 Docker 镜像的 CMD。字符串,长度限制:0-2047 字符。
entrypoint
string
容器启动 entrypoint。该配置会覆盖 Docker 镜像的 ENTRYPOINT。字符串,长度限制:0-2047 字符。
clusterId
string
指定集群 ID 创建实例,填空值则随机在一个集群创建实例。字符串,长度限制:0-255 字符。
localStorageMountPoint
string
本地存储的挂载路径。默认值:“/workspace”,字符串,长度限制:1-4095 字符。
networkStorages
object[]
云存储挂载配置。数组,最多支持挂载 30 个云存储。
networkId
string
vpc 网络 ID。不使用 vpc 网络则填空值。
kind
string
必填
实例类型。可选值:cpu、gpu。取值固定为 cpu。

响应参数

id
string
创建的实例 ID。
最后修改于 2026年1月12日