获取模板列表
curl --request GET \
--url https://api.ppio.com/gpu-instance/openapi/v1/templates \
--header 'Authorization: <authorization>'{
"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>"
}
],
"total": 123
}模板
获取模板列表
GET
/
gpu-instance
/
openapi
/
v1
/
templates
获取模板列表
curl --request GET \
--url https://api.ppio.com/gpu-instance/openapi/v1/templates \
--header 'Authorization: <authorization>'{
"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>"
}
],
"total": 123
}请求头
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。
查询参数
获取 x 条/页。整数,取值范围:大于等于 0。
获取第 x 页。整数,取值范围:大于等于 0。
筛选指定模板名称(支持模糊匹配)。长度:[1-255]。
筛选模板分类。可选值:
official:官方模板community:社区模板private:私有模板
模板可见性。查询官方、社区模板传 false;查询私有模板传 true。
响应参数
模板信息列表。
隐藏 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/templates?pageSize=10&pageNum=1&name=test&channel=private&isMyCommunity=true' \
--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"
}
],
"total": 12
}
⌘I