获取模板详情
curl --request GET \
--url https://api.ppio.com/gpu-instance/openapi/v1/template \
--header 'Authorization: <authorization>'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/template"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.ppio.com/gpu-instance/openapi/v1/template', 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/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ppio.com/gpu-instance/openapi/v1/template"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://api.ppio.com/gpu-instance/openapi/v1/template")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/gpu-instance/openapi/v1/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"template": {
"Id": "<string>",
"name": "<string>",
"readme": "<string>",
"type": "<string>",
"channel": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{}
],
"envs": [
{}
],
"tools": [
{}
],
"createdAt": "<string>",
"recommendCards": [
{}
],
"minCudaVersion": "<string>"
}
}模板
获取模板详情
GET
/
gpu-instance
/
openapi
/
v1
/
template
获取模板详情
curl --request GET \
--url https://api.ppio.com/gpu-instance/openapi/v1/template \
--header 'Authorization: <authorization>'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/template"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.ppio.com/gpu-instance/openapi/v1/template', 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/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ppio.com/gpu-instance/openapi/v1/template"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://api.ppio.com/gpu-instance/openapi/v1/template")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/gpu-instance/openapi/v1/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"template": {
"Id": "<string>",
"name": "<string>",
"readme": "<string>",
"type": "<string>",
"channel": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{}
],
"envs": [
{}
],
"tools": [
{}
],
"createdAt": "<string>",
"recommendCards": [
{}
],
"minCudaVersion": "<string>"
}
}请求头
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。
查询参数
模板 ID。
响应参数
模板信息。
隐藏 properties
隐藏 properties
模板唯一 ID。
模板名称。
模板说明。
模板类型,例如
instance。模板分类:
official、community、private。镜像地址。
平台镜像认证 ID。
实例启动命令。
实例启动 entrypoint。
系统盘大小(GB)。
端口配置列表。
环境变量配置列表。
模板内置工具列表(仅官方模板有)。
模板创建时间戳(Unix 秒)。
模板推荐的 GPU 卡规格信息(仅官方模板有)。
模板要求的最低 CUDA 版本。
示例
请求示例
curl --location --request GET 'https://api.ppio.com/gpu-instance/openapi/v1/template?templateId=101038' \
--header 'Authorization: Bearer {{API 密钥}}'
响应示例
{
"template": {
"Id": "1",
"name": "Pytorch:v2",
"readme": "...",
"type": "instance",
"channel": "official",
"image": "test-image.ppinfra.com/test-public/pytorch:v2",
"imageAuth": "",
"startCommand": "",
"entrypoint": "",
"rootfsSize": 100,
"ports": [
{"type": "http", "ports": [80]},
{"type": "tcp", "ports": [7860]}
],
"envs": [{"key": "test", "value": "template"}],
"tools": [{"name": "Jupyter", "describe": "Start Jupyter Notebook", "port": 8888, "type": "http"}],
"createdAt": "1715760544",
"recommendCards": [{"gpuSpecId": "4090.18c.60g", "cardNum": "2"}],
"minCudaVersion": "11.8"
}
}
最后修改于 2026年6月16日
⌘I