创建 GPU 实例
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>",
"gpuNum": 123,
"rootfsSize": 123,
"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>",
"networkStorages": [
{
"Id": "<string>",
"mountPoint": "<string>"
}
],
"networkId": "<string>",
"kind": "<string>",
"month": 123,
"billingMode": "<string>",
"autoRenew": true,
"autoRenewMonth": 123,
"minCudaVersion": "<string>"
}
'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create"
payload = {
"name": "<string>",
"productId": "<string>",
"gpuNum": 123,
"rootfsSize": 123,
"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>",
"networkStorages": [
{
"Id": "<string>",
"mountPoint": "<string>"
}
],
"networkId": "<string>",
"kind": "<string>",
"month": 123,
"billingMode": "<string>",
"autoRenew": True,
"autoRenewMonth": 123,
"minCudaVersion": "<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>',
gpuNum: 123,
rootfsSize: 123,
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>',
networkStorages: [{Id: '<string>', mountPoint: '<string>'}],
networkId: '<string>',
kind: '<string>',
month: 123,
billingMode: '<string>',
autoRenew: true,
autoRenewMonth: 123,
minCudaVersion: '<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>',
'gpuNum' => 123,
'rootfsSize' => 123,
'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>',
'networkStorages' => [
[
'Id' => '<string>',
'mountPoint' => '<string>'
]
],
'networkId' => '<string>',
'kind' => '<string>',
'month' => 123,
'billingMode' => '<string>',
'autoRenew' => true,
'autoRenewMonth' => 123,
'minCudaVersion' => '<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}实例
创建 GPU 实例
POST
/
gpu-instance
/
openapi
/
v1
/
gpu
/
instance
/
create
创建 GPU 实例
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>",
"gpuNum": 123,
"rootfsSize": 123,
"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>",
"networkStorages": [
{
"Id": "<string>",
"mountPoint": "<string>"
}
],
"networkId": "<string>",
"kind": "<string>",
"month": 123,
"billingMode": "<string>",
"autoRenew": true,
"autoRenewMonth": 123,
"minCudaVersion": "<string>"
}
'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/gpu/instance/create"
payload = {
"name": "<string>",
"productId": "<string>",
"gpuNum": 123,
"rootfsSize": 123,
"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>",
"networkStorages": [
{
"Id": "<string>",
"mountPoint": "<string>"
}
],
"networkId": "<string>",
"kind": "<string>",
"month": 123,
"billingMode": "<string>",
"autoRenew": True,
"autoRenewMonth": 123,
"minCudaVersion": "<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>',
gpuNum: 123,
rootfsSize: 123,
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>',
networkStorages: [{Id: '<string>', mountPoint: '<string>'}],
networkId: '<string>',
kind: '<string>',
month: 123,
billingMode: '<string>',
autoRenew: true,
autoRenewMonth: 123,
minCudaVersion: '<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>',
'gpuNum' => 123,
'rootfsSize' => 123,
'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>',
'networkStorages' => [
[
'Id' => '<string>',
'mountPoint' => '<string>'
]
],
'networkId' => '<string>',
'kind' => '<string>',
'month' => 123,
'billingMode' => '<string>',
'autoRenew' => true,
'autoRenewMonth' => 123,
'minCudaVersion' => '<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<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 \"gpuNum\": 123,\n \"rootfsSize\": 123,\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 \"networkStorages\": [\n {\n \"Id\": \"<string>\",\n \"mountPoint\": \"<string>\"\n }\n ],\n \"networkId\": \"<string>\",\n \"kind\": \"<string>\",\n \"month\": 123,\n \"billingMode\": \"<string>\",\n \"autoRenew\": true,\n \"autoRenewMonth\": 123,\n \"minCudaVersion\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}请求头
枚举值:application/json。
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。
请求体
实例名称。字符串,长度限制:0-255 字符。
GPU 产品 ID。字符串,长度限制:1-255 字符。可以调用获取 GPU 产品列表接口查询。
GPU 数量。整数,取值范围:[1, 8]。
系统盘大小。整数,取值范围:[10, 6144]。最小值小于 10 GB 时,系统会默认设置为 10GB。最大值上限受可用存储资源限制动态变化,可通过产品列表接口查询。
镜像地址。字符串,长度限制:1-500 字符。
镜像认证(username:password)。字符串,长度限制:0-10239 字符。
镜像仓库认证ID。
实例开放端口,示例: 80/http, 3306/tcp。支持的端口号范围:[1-65535],其中 2222, 2223, 2224 为内部端口,不可使用。支持的端口类型为 [tcp、http]。ports + tools 最多使用 15 个端口。
实例启动命令。字符串,长度限制:0-2047 字符。
实例启动 entrypoint。该配置会覆盖 Docker 镜像的 ENTRYPOINT。字符串,长度限制:0-2047 字符。
指定集群 ID 创建实例,填空值则随机在一个集群创建实例。
vpc网络ID,不使用 vpc 网络则填空值。
实例类型。取值范围:[gpu、cpu]。
包年包月实例月份,填 0 则创建按量付费实例。整数,取值范围:大于等于 0。
实例的计费方式。可选值:
默认值:
注意:如果设置了 month > 0,则强制为
onDemand(按量计费)、monthly(包年包月)、spot(抢占式计费)。默认值:
onDemand。注意:如果设置了 month > 0,则强制为
monthly 计费方式。onDemand:按量计费monthly:包年包月计费spot:抢占式计费
是否自动续费。布尔值,默认值:false。
注意:只有包年包月计费生效时,该参数才有效。
注意:只有包年包月计费生效时,该参数才有效。
自动续费月数。整数,取值范围:1-12。
注意:只有包年包月计费生效并且自动续费开启时,该参数才有效。
注意:只有包年包月计费生效并且自动续费开启时,该参数才有效。
创建实例支持的最小 CUDA 版本,需填写指定格式,例如:11.8、12.4。长度:[0-255]。
响应参数
创建的实例 ID。
最后修改于 2026年6月16日
⌘I