curl --request POST \
--url https://api.novita.ai/gpus/v2/instances \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "example-instance",
"product_id": "product-id",
"image": "registry.example.com/namespace/image:tag",
"billing": {
"mode": "prepaid",
"prepaid": {
"months": 1,
"auto_renew": {
"enabled": true,
"months": 1
}
}
},
"resource": {
"rootfs_size_gb": 20,
"gpu_num": 1,
"min_cuda_version": ""
},
"registry_auth_id": "registry-auth-id",
"entrypoint": "",
"command": "",
"envs": [
{
"key": "ENV_NAME",
"value": "ENV_VALUE"
}
],
"ports": [
{
"port": 8080,
"protocol": "tcp"
}
],
"network": {
"id": "vpc-550e8400-e29b-41d4-a716-446655440000",
"ip": "10.2.1.1"
},
"volumes": [
{
"type": "network",
"id": "network-storage-id",
"mount_point": "/data"
}
],
"candidate_regions": [
"region-id"
],
"tools": {
"jupyter": {
"enabled": true,
"port": 8888,
"protocol": "http"
}
},
"auto_migrate": {
"enabled": false,
"include_system_disk": false
}
}
'import requests
url = "https://api.novita.ai/gpus/v2/instances"
payload = {
"name": "example-instance",
"product_id": "product-id",
"image": "registry.example.com/namespace/image:tag",
"billing": {
"mode": "prepaid",
"prepaid": {
"months": 1,
"auto_renew": {
"enabled": True,
"months": 1
}
}
},
"resource": {
"rootfs_size_gb": 20,
"gpu_num": 1,
"min_cuda_version": ""
},
"registry_auth_id": "registry-auth-id",
"entrypoint": "",
"command": "",
"envs": [
{
"key": "ENV_NAME",
"value": "ENV_VALUE"
}
],
"ports": [
{
"port": 8080,
"protocol": "tcp"
}
],
"network": {
"id": "vpc-550e8400-e29b-41d4-a716-446655440000",
"ip": "10.2.1.1"
},
"volumes": [
{
"type": "network",
"id": "network-storage-id",
"mount_point": "/data"
}
],
"candidate_regions": ["region-id"],
"tools": { "jupyter": {
"enabled": True,
"port": 8888,
"protocol": "http"
} },
"auto_migrate": {
"enabled": False,
"include_system_disk": False
}
}
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: 'example-instance',
product_id: 'product-id',
image: 'registry.example.com/namespace/image:tag',
billing: {mode: 'prepaid', prepaid: {months: 1, auto_renew: {enabled: true, months: 1}}},
resource: {rootfs_size_gb: 20, gpu_num: 1, min_cuda_version: ''},
registry_auth_id: 'registry-auth-id',
entrypoint: '',
command: '',
envs: [{key: 'ENV_NAME', value: 'ENV_VALUE'}],
ports: [{port: 8080, protocol: 'tcp'}],
network: {id: 'vpc-550e8400-e29b-41d4-a716-446655440000', ip: '10.2.1.1'},
volumes: [{type: 'network', id: 'network-storage-id', mount_point: '/data'}],
candidate_regions: ['region-id'],
tools: {jupyter: {enabled: true, port: 8888, protocol: 'http'}},
auto_migrate: {enabled: false, include_system_disk: false}
})
};
fetch('https://api.novita.ai/gpus/v2/instances', 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/instances",
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' => 'example-instance',
'product_id' => 'product-id',
'image' => 'registry.example.com/namespace/image:tag',
'billing' => [
'mode' => 'prepaid',
'prepaid' => [
'months' => 1,
'auto_renew' => [
'enabled' => true,
'months' => 1
]
]
],
'resource' => [
'rootfs_size_gb' => 20,
'gpu_num' => 1,
'min_cuda_version' => ''
],
'registry_auth_id' => 'registry-auth-id',
'entrypoint' => '',
'command' => '',
'envs' => [
[
'key' => 'ENV_NAME',
'value' => 'ENV_VALUE'
]
],
'ports' => [
[
'port' => 8080,
'protocol' => 'tcp'
]
],
'network' => [
'id' => 'vpc-550e8400-e29b-41d4-a716-446655440000',
'ip' => '10.2.1.1'
],
'volumes' => [
[
'type' => 'network',
'id' => 'network-storage-id',
'mount_point' => '/data'
]
],
'candidate_regions' => [
'region-id'
],
'tools' => [
'jupyter' => [
'enabled' => true,
'port' => 8888,
'protocol' => 'http'
]
],
'auto_migrate' => [
'enabled' => false,
'include_system_disk' => false
]
]),
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/instances"
payload := strings.NewReader("{\n \"name\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\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/instances")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"name\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/gpus/v2/instances")
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\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ca338f12f3"
}Create Instance
curl --request POST \
--url https://api.novita.ai/gpus/v2/instances \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "example-instance",
"product_id": "product-id",
"image": "registry.example.com/namespace/image:tag",
"billing": {
"mode": "prepaid",
"prepaid": {
"months": 1,
"auto_renew": {
"enabled": true,
"months": 1
}
}
},
"resource": {
"rootfs_size_gb": 20,
"gpu_num": 1,
"min_cuda_version": ""
},
"registry_auth_id": "registry-auth-id",
"entrypoint": "",
"command": "",
"envs": [
{
"key": "ENV_NAME",
"value": "ENV_VALUE"
}
],
"ports": [
{
"port": 8080,
"protocol": "tcp"
}
],
"network": {
"id": "vpc-550e8400-e29b-41d4-a716-446655440000",
"ip": "10.2.1.1"
},
"volumes": [
{
"type": "network",
"id": "network-storage-id",
"mount_point": "/data"
}
],
"candidate_regions": [
"region-id"
],
"tools": {
"jupyter": {
"enabled": true,
"port": 8888,
"protocol": "http"
}
},
"auto_migrate": {
"enabled": false,
"include_system_disk": false
}
}
'import requests
url = "https://api.novita.ai/gpus/v2/instances"
payload = {
"name": "example-instance",
"product_id": "product-id",
"image": "registry.example.com/namespace/image:tag",
"billing": {
"mode": "prepaid",
"prepaid": {
"months": 1,
"auto_renew": {
"enabled": True,
"months": 1
}
}
},
"resource": {
"rootfs_size_gb": 20,
"gpu_num": 1,
"min_cuda_version": ""
},
"registry_auth_id": "registry-auth-id",
"entrypoint": "",
"command": "",
"envs": [
{
"key": "ENV_NAME",
"value": "ENV_VALUE"
}
],
"ports": [
{
"port": 8080,
"protocol": "tcp"
}
],
"network": {
"id": "vpc-550e8400-e29b-41d4-a716-446655440000",
"ip": "10.2.1.1"
},
"volumes": [
{
"type": "network",
"id": "network-storage-id",
"mount_point": "/data"
}
],
"candidate_regions": ["region-id"],
"tools": { "jupyter": {
"enabled": True,
"port": 8888,
"protocol": "http"
} },
"auto_migrate": {
"enabled": False,
"include_system_disk": False
}
}
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: 'example-instance',
product_id: 'product-id',
image: 'registry.example.com/namespace/image:tag',
billing: {mode: 'prepaid', prepaid: {months: 1, auto_renew: {enabled: true, months: 1}}},
resource: {rootfs_size_gb: 20, gpu_num: 1, min_cuda_version: ''},
registry_auth_id: 'registry-auth-id',
entrypoint: '',
command: '',
envs: [{key: 'ENV_NAME', value: 'ENV_VALUE'}],
ports: [{port: 8080, protocol: 'tcp'}],
network: {id: 'vpc-550e8400-e29b-41d4-a716-446655440000', ip: '10.2.1.1'},
volumes: [{type: 'network', id: 'network-storage-id', mount_point: '/data'}],
candidate_regions: ['region-id'],
tools: {jupyter: {enabled: true, port: 8888, protocol: 'http'}},
auto_migrate: {enabled: false, include_system_disk: false}
})
};
fetch('https://api.novita.ai/gpus/v2/instances', 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/instances",
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' => 'example-instance',
'product_id' => 'product-id',
'image' => 'registry.example.com/namespace/image:tag',
'billing' => [
'mode' => 'prepaid',
'prepaid' => [
'months' => 1,
'auto_renew' => [
'enabled' => true,
'months' => 1
]
]
],
'resource' => [
'rootfs_size_gb' => 20,
'gpu_num' => 1,
'min_cuda_version' => ''
],
'registry_auth_id' => 'registry-auth-id',
'entrypoint' => '',
'command' => '',
'envs' => [
[
'key' => 'ENV_NAME',
'value' => 'ENV_VALUE'
]
],
'ports' => [
[
'port' => 8080,
'protocol' => 'tcp'
]
],
'network' => [
'id' => 'vpc-550e8400-e29b-41d4-a716-446655440000',
'ip' => '10.2.1.1'
],
'volumes' => [
[
'type' => 'network',
'id' => 'network-storage-id',
'mount_point' => '/data'
]
],
'candidate_regions' => [
'region-id'
],
'tools' => [
'jupyter' => [
'enabled' => true,
'port' => 8888,
'protocol' => 'http'
]
],
'auto_migrate' => [
'enabled' => false,
'include_system_disk' => false
]
]),
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/instances"
payload := strings.NewReader("{\n \"name\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\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/instances")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"name\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/gpus/v2/instances")
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\": \"example-instance\",\n \"product_id\": \"product-id\",\n \"image\": \"registry.example.com/namespace/image:tag\",\n \"billing\": {\n \"mode\": \"prepaid\",\n \"prepaid\": {\n \"months\": 1,\n \"auto_renew\": {\n \"enabled\": true,\n \"months\": 1\n }\n }\n },\n \"resource\": {\n \"rootfs_size_gb\": 20,\n \"gpu_num\": 1,\n \"min_cuda_version\": \"\"\n },\n \"registry_auth_id\": \"registry-auth-id\",\n \"entrypoint\": \"\",\n \"command\": \"\",\n \"envs\": [\n {\n \"key\": \"ENV_NAME\",\n \"value\": \"ENV_VALUE\"\n }\n ],\n \"ports\": [\n {\n \"port\": 8080,\n \"protocol\": \"tcp\"\n }\n ],\n \"network\": {\n \"id\": \"vpc-550e8400-e29b-41d4-a716-446655440000\",\n \"ip\": \"10.2.1.1\"\n },\n \"volumes\": [\n {\n \"type\": \"network\",\n \"id\": \"network-storage-id\",\n \"mount_point\": \"/data\"\n }\n ],\n \"candidate_regions\": [\n \"region-id\"\n ],\n \"tools\": {\n \"jupyter\": {\n \"enabled\": true,\n \"port\": 8888,\n \"protocol\": \"http\"\n }\n },\n \"auto_migrate\": {\n \"enabled\": false,\n \"include_system_disk\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ca338f12f3"
}Headers
Allowed value: application/json.
Bearer authentication format, e.g.: Bearer {{API_KEY}}.
Body
Instance name. String, length: 1-255 characters.
"example-instance"
Product ID.
"product-id"
Image address. String, length: 1-500 characters.
"registry.example.com/namespace/image:tag"
Billing configuration.
Show child attributes
Show child attributes
Resource configuration.
Show child attributes
Show child attributes
Instance type. Allowed values: gpu, cpu. Default: gpu.
gpu, cpu Saved registry authentication ID. String, length: 0-255 characters.
"registry-auth-id"
Container entrypoint.
""
Container startup command.
""
Environment variable list.
Show child attributes
Show child attributes
Exposed port list.
Show child attributes
Show child attributes
VPC network configuration.
Show child attributes
Show child attributes
Data disk / network storage mounts.
Show child attributes
Show child attributes
Candidate regions for scheduling. The instance is finally scheduled to one of them.
["region-id"]Instance tool configuration. Currently only Jupyter is supported.
Show child attributes
Show child attributes
Auto-migrate configuration.
Show child attributes
Show child attributes
Response
OK
ID of the created instance
"ca338f12f3"
Was this page helpful?