Create Template
curl --request POST \
--url https://api.novita.ai/gpus/v2/templates \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "pytorch-2.3-cuda12",
"type": "instance",
"image": "registry.example.com/ml/pytorch:2.3-cuda12",
"registry_auth_id": "auth-001",
"command": "",
"entrypoint": "/bin/bash",
"rootfs_size_gb": 50,
"ports": [
{
"protocol": "http",
"port": 8888
}
],
"envs": [
{
"key": "ENV",
"value": "prod"
}
],
"metadata": {
"readme": "PyTorch 2.3 with CUDA 12",
"logo": "https://example.com/logo.png",
"description": "PyTorch development template",
"author": "PAI",
"tags": [
"pytorch",
"cuda"
]
},
"min_cuda_version": "12.2"
}
'import requests
url = "https://api.novita.ai/gpus/v2/templates"
payload = {
"name": "pytorch-2.3-cuda12",
"type": "instance",
"image": "registry.example.com/ml/pytorch:2.3-cuda12",
"registry_auth_id": "auth-001",
"command": "",
"entrypoint": "/bin/bash",
"rootfs_size_gb": 50,
"ports": [
{
"protocol": "http",
"port": 8888
}
],
"envs": [
{
"key": "ENV",
"value": "prod"
}
],
"metadata": {
"readme": "PyTorch 2.3 with CUDA 12",
"logo": "https://example.com/logo.png",
"description": "PyTorch development template",
"author": "PAI",
"tags": ["pytorch", "cuda"]
},
"min_cuda_version": "12.2"
}
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: 'pytorch-2.3-cuda12',
type: 'instance',
image: 'registry.example.com/ml/pytorch:2.3-cuda12',
registry_auth_id: 'auth-001',
command: '',
entrypoint: '/bin/bash',
rootfs_size_gb: 50,
ports: [{protocol: 'http', port: 8888}],
envs: [{key: 'ENV', value: 'prod'}],
metadata: {
readme: 'PyTorch 2.3 with CUDA 12',
logo: 'https://example.com/logo.png',
description: 'PyTorch development template',
author: 'PAI',
tags: ['pytorch', 'cuda']
},
min_cuda_version: '12.2'
})
};
fetch('https://api.novita.ai/gpus/v2/templates', 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.novita.ai/gpus/v2/templates",
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' => 'pytorch-2.3-cuda12',
'type' => 'instance',
'image' => 'registry.example.com/ml/pytorch:2.3-cuda12',
'registry_auth_id' => 'auth-001',
'command' => '',
'entrypoint' => '/bin/bash',
'rootfs_size_gb' => 50,
'ports' => [
[
'protocol' => 'http',
'port' => 8888
]
],
'envs' => [
[
'key' => 'ENV',
'value' => 'prod'
]
],
'metadata' => [
'readme' => 'PyTorch 2.3 with CUDA 12',
'logo' => 'https://example.com/logo.png',
'description' => 'PyTorch development template',
'author' => 'PAI',
'tags' => [
'pytorch',
'cuda'
]
],
'min_cuda_version' => '12.2'
]),
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.novita.ai/gpus/v2/templates"
payload := strings.NewReader("{\n \"name\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\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.novita.ai/gpus/v2/templates")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"name\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/gpus/v2/templates")
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\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\n}"
response = http.request(request)
puts response.read_body{
"template_id": "tpl-001"
}Template
Create Template
POST
/
gpus
/
v2
/
templates
Create Template
curl --request POST \
--url https://api.novita.ai/gpus/v2/templates \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "pytorch-2.3-cuda12",
"type": "instance",
"image": "registry.example.com/ml/pytorch:2.3-cuda12",
"registry_auth_id": "auth-001",
"command": "",
"entrypoint": "/bin/bash",
"rootfs_size_gb": 50,
"ports": [
{
"protocol": "http",
"port": 8888
}
],
"envs": [
{
"key": "ENV",
"value": "prod"
}
],
"metadata": {
"readme": "PyTorch 2.3 with CUDA 12",
"logo": "https://example.com/logo.png",
"description": "PyTorch development template",
"author": "PAI",
"tags": [
"pytorch",
"cuda"
]
},
"min_cuda_version": "12.2"
}
'import requests
url = "https://api.novita.ai/gpus/v2/templates"
payload = {
"name": "pytorch-2.3-cuda12",
"type": "instance",
"image": "registry.example.com/ml/pytorch:2.3-cuda12",
"registry_auth_id": "auth-001",
"command": "",
"entrypoint": "/bin/bash",
"rootfs_size_gb": 50,
"ports": [
{
"protocol": "http",
"port": 8888
}
],
"envs": [
{
"key": "ENV",
"value": "prod"
}
],
"metadata": {
"readme": "PyTorch 2.3 with CUDA 12",
"logo": "https://example.com/logo.png",
"description": "PyTorch development template",
"author": "PAI",
"tags": ["pytorch", "cuda"]
},
"min_cuda_version": "12.2"
}
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: 'pytorch-2.3-cuda12',
type: 'instance',
image: 'registry.example.com/ml/pytorch:2.3-cuda12',
registry_auth_id: 'auth-001',
command: '',
entrypoint: '/bin/bash',
rootfs_size_gb: 50,
ports: [{protocol: 'http', port: 8888}],
envs: [{key: 'ENV', value: 'prod'}],
metadata: {
readme: 'PyTorch 2.3 with CUDA 12',
logo: 'https://example.com/logo.png',
description: 'PyTorch development template',
author: 'PAI',
tags: ['pytorch', 'cuda']
},
min_cuda_version: '12.2'
})
};
fetch('https://api.novita.ai/gpus/v2/templates', 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.novita.ai/gpus/v2/templates",
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' => 'pytorch-2.3-cuda12',
'type' => 'instance',
'image' => 'registry.example.com/ml/pytorch:2.3-cuda12',
'registry_auth_id' => 'auth-001',
'command' => '',
'entrypoint' => '/bin/bash',
'rootfs_size_gb' => 50,
'ports' => [
[
'protocol' => 'http',
'port' => 8888
]
],
'envs' => [
[
'key' => 'ENV',
'value' => 'prod'
]
],
'metadata' => [
'readme' => 'PyTorch 2.3 with CUDA 12',
'logo' => 'https://example.com/logo.png',
'description' => 'PyTorch development template',
'author' => 'PAI',
'tags' => [
'pytorch',
'cuda'
]
],
'min_cuda_version' => '12.2'
]),
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.novita.ai/gpus/v2/templates"
payload := strings.NewReader("{\n \"name\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\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.novita.ai/gpus/v2/templates")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"name\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/gpus/v2/templates")
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\": \"pytorch-2.3-cuda12\",\n \"type\": \"instance\",\n \"image\": \"registry.example.com/ml/pytorch:2.3-cuda12\",\n \"registry_auth_id\": \"auth-001\",\n \"command\": \"\",\n \"entrypoint\": \"/bin/bash\",\n \"rootfs_size_gb\": 50,\n \"ports\": [\n {\n \"protocol\": \"http\",\n \"port\": 8888\n }\n ],\n \"envs\": [\n {\n \"key\": \"ENV\",\n \"value\": \"prod\"\n }\n ],\n \"metadata\": {\n \"readme\": \"PyTorch 2.3 with CUDA 12\",\n \"logo\": \"https://example.com/logo.png\",\n \"description\": \"PyTorch development template\",\n \"author\": \"PAI\",\n \"tags\": [\n \"pytorch\",\n \"cuda\"\n ]\n },\n \"min_cuda_version\": \"12.2\"\n}"
response = http.request(request)
puts response.read_body{
"template_id": "tpl-001"
}Headers
Allowed value: application/json.
Bearer authentication format, e.g.: Bearer {{API_KEY}}.
Body
application/json
Template name.
Example:
"pytorch-2.3-cuda12"
Template type.
Example:
"instance"
Image address.
Example:
"registry.example.com/ml/pytorch:2.3-cuda12"
Registry authentication ID.
Example:
"auth-001"
Startup command.
Example:
""
Image entrypoint.
Example:
"/bin/bash"
Root disk size. Unit: GB.
Example:
50
Exposed port configuration.
Show child attributes
Show child attributes
Environment variables.
Show child attributes
Show child attributes
Template metadata.
Show child attributes
Show child attributes
Minimum CUDA version.
Example:
"12.2"
Response
200 - application/json
OK
Template ID
Example:
"tpl-001"
Last modified on June 23, 2026
Was this page helpful?
⌘I