curl --request POST \
--url https://api.gcore.com/cloud/v3/inference/{project_id}/deployments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"containers": [
{
"region_id": 1,
"scale": {
"cooldown_period": 60,
"max": 3,
"min": 1,
"triggers": {
"cpu": {
"threshold": 80
},
"memory": {
"threshold": 70
}
}
}
}
],
"flavor_name": "inference-16vcpu-232gib-1xh100-80gb",
"image": "nginx:latest",
"listening_port": 80,
"name": "my-instance",
"api_keys": [
"key1",
"key2"
],
"auth_enabled": false,
"command": [
"nginx",
"-g",
"daemon off;"
],
"credentials_name": "dockerhub",
"description": "My first instance",
"envs": {
"DEBUG_MODE": "False",
"KEY": "12345"
},
"ingress_opts": {
"disable_response_buffering": true
},
"logging": {
"destination_region_id": 1,
"enabled": true,
"retention_policy": {
"period": 42
},
"topic_name": "my-log-name"
},
"probes": {
"liveness_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
},
"readiness_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
},
"startup_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
}
},
"timeout": 120
}
'import requests
url = "https://api.gcore.com/cloud/v3/inference/{project_id}/deployments"
payload = {
"containers": [
{
"region_id": 1,
"scale": {
"cooldown_period": 60,
"max": 3,
"min": 1,
"triggers": {
"cpu": { "threshold": 80 },
"memory": { "threshold": 70 }
}
}
}
],
"flavor_name": "inference-16vcpu-232gib-1xh100-80gb",
"image": "nginx:latest",
"listening_port": 80,
"name": "my-instance",
"api_keys": ["key1", "key2"],
"auth_enabled": False,
"command": ["nginx", "-g", "daemon off;"],
"credentials_name": "dockerhub",
"description": "My first instance",
"envs": {
"DEBUG_MODE": "False",
"KEY": "12345"
},
"ingress_opts": { "disable_response_buffering": True },
"logging": {
"destination_region_id": 1,
"enabled": True,
"retention_policy": { "period": 42 },
"topic_name": "my-log-name"
},
"probes": {
"liveness_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
},
"readiness_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
},
"startup_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
}
},
"timeout": 120
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
containers: [
{
region_id: 1,
scale: {
cooldown_period: 60,
max: 3,
min: 1,
triggers: {cpu: {threshold: 80}, memory: {threshold: 70}}
}
}
],
flavor_name: 'inference-16vcpu-232gib-1xh100-80gb',
image: 'nginx:latest',
listening_port: 80,
name: 'my-instance',
api_keys: ['key1', 'key2'],
auth_enabled: false,
command: ['nginx', '-g', 'daemon off;'],
credentials_name: 'dockerhub',
description: 'My first instance',
envs: {DEBUG_MODE: 'False', KEY: '12345'},
ingress_opts: {disable_response_buffering: true},
logging: {
destination_region_id: 1,
enabled: true,
retention_policy: {period: 42},
topic_name: 'my-log-name'
},
probes: {
liveness_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
},
readiness_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
},
startup_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
}
},
timeout: 120
})
};
fetch('https://api.gcore.com/cloud/v3/inference/{project_id}/deployments', 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.gcore.com/cloud/v3/inference/{project_id}/deployments",
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([
'containers' => [
[
'region_id' => 1,
'scale' => [
'cooldown_period' => 60,
'max' => 3,
'min' => 1,
'triggers' => [
'cpu' => [
'threshold' => 80
],
'memory' => [
'threshold' => 70
]
]
]
]
],
'flavor_name' => 'inference-16vcpu-232gib-1xh100-80gb',
'image' => 'nginx:latest',
'listening_port' => 80,
'name' => 'my-instance',
'api_keys' => [
'key1',
'key2'
],
'auth_enabled' => false,
'command' => [
'nginx',
'-g',
'daemon off;'
],
'credentials_name' => 'dockerhub',
'description' => 'My first instance',
'envs' => [
'DEBUG_MODE' => 'False',
'KEY' => '12345'
],
'ingress_opts' => [
'disable_response_buffering' => true
],
'logging' => [
'destination_region_id' => 1,
'enabled' => true,
'retention_policy' => [
'period' => 42
],
'topic_name' => 'my-log-name'
],
'probes' => [
'liveness_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
],
'readiness_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
],
'startup_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
]
],
'timeout' => 120
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.gcore.com/cloud/v3/inference/{project_id}/deployments"
payload := strings.NewReader("{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.gcore.com/cloud/v3/inference/{project_id}/deployments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v3/inference/{project_id}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}Create inference deployment
curl --request POST \
--url https://api.gcore.com/cloud/v3/inference/{project_id}/deployments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"containers": [
{
"region_id": 1,
"scale": {
"cooldown_period": 60,
"max": 3,
"min": 1,
"triggers": {
"cpu": {
"threshold": 80
},
"memory": {
"threshold": 70
}
}
}
}
],
"flavor_name": "inference-16vcpu-232gib-1xh100-80gb",
"image": "nginx:latest",
"listening_port": 80,
"name": "my-instance",
"api_keys": [
"key1",
"key2"
],
"auth_enabled": false,
"command": [
"nginx",
"-g",
"daemon off;"
],
"credentials_name": "dockerhub",
"description": "My first instance",
"envs": {
"DEBUG_MODE": "False",
"KEY": "12345"
},
"ingress_opts": {
"disable_response_buffering": true
},
"logging": {
"destination_region_id": 1,
"enabled": true,
"retention_policy": {
"period": 42
},
"topic_name": "my-log-name"
},
"probes": {
"liveness_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
},
"readiness_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
},
"startup_probe": {
"enabled": true,
"probe": {
"exec": {
"command": [
"ls",
"-l"
]
},
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": {
"Authorization": "Bearer token 123"
},
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": {
"port": 80
},
"timeout_seconds": 1
}
}
},
"timeout": 120
}
'import requests
url = "https://api.gcore.com/cloud/v3/inference/{project_id}/deployments"
payload = {
"containers": [
{
"region_id": 1,
"scale": {
"cooldown_period": 60,
"max": 3,
"min": 1,
"triggers": {
"cpu": { "threshold": 80 },
"memory": { "threshold": 70 }
}
}
}
],
"flavor_name": "inference-16vcpu-232gib-1xh100-80gb",
"image": "nginx:latest",
"listening_port": 80,
"name": "my-instance",
"api_keys": ["key1", "key2"],
"auth_enabled": False,
"command": ["nginx", "-g", "daemon off;"],
"credentials_name": "dockerhub",
"description": "My first instance",
"envs": {
"DEBUG_MODE": "False",
"KEY": "12345"
},
"ingress_opts": { "disable_response_buffering": True },
"logging": {
"destination_region_id": 1,
"enabled": True,
"retention_policy": { "period": 42 },
"topic_name": "my-log-name"
},
"probes": {
"liveness_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
},
"readiness_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
},
"startup_probe": {
"enabled": True,
"probe": {
"exec": { "command": ["ls", "-l"] },
"failure_threshold": 3,
"http_get": {
"port": 80,
"headers": { "Authorization": "Bearer token 123" },
"host": "127.0.0.1",
"path": "/healthz",
"schema": "HTTP"
},
"initial_delay_seconds": 0,
"period_seconds": 5,
"success_threshold": 1,
"tcp_socket": { "port": 80 },
"timeout_seconds": 1
}
}
},
"timeout": 120
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
containers: [
{
region_id: 1,
scale: {
cooldown_period: 60,
max: 3,
min: 1,
triggers: {cpu: {threshold: 80}, memory: {threshold: 70}}
}
}
],
flavor_name: 'inference-16vcpu-232gib-1xh100-80gb',
image: 'nginx:latest',
listening_port: 80,
name: 'my-instance',
api_keys: ['key1', 'key2'],
auth_enabled: false,
command: ['nginx', '-g', 'daemon off;'],
credentials_name: 'dockerhub',
description: 'My first instance',
envs: {DEBUG_MODE: 'False', KEY: '12345'},
ingress_opts: {disable_response_buffering: true},
logging: {
destination_region_id: 1,
enabled: true,
retention_policy: {period: 42},
topic_name: 'my-log-name'
},
probes: {
liveness_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
},
readiness_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
},
startup_probe: {
enabled: true,
probe: {
exec: {command: ['ls', '-l']},
failure_threshold: 3,
http_get: {
port: 80,
headers: {Authorization: 'Bearer token 123'},
host: '127.0.0.1',
path: '/healthz',
schema: 'HTTP'
},
initial_delay_seconds: 0,
period_seconds: 5,
success_threshold: 1,
tcp_socket: {port: 80},
timeout_seconds: 1
}
}
},
timeout: 120
})
};
fetch('https://api.gcore.com/cloud/v3/inference/{project_id}/deployments', 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.gcore.com/cloud/v3/inference/{project_id}/deployments",
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([
'containers' => [
[
'region_id' => 1,
'scale' => [
'cooldown_period' => 60,
'max' => 3,
'min' => 1,
'triggers' => [
'cpu' => [
'threshold' => 80
],
'memory' => [
'threshold' => 70
]
]
]
]
],
'flavor_name' => 'inference-16vcpu-232gib-1xh100-80gb',
'image' => 'nginx:latest',
'listening_port' => 80,
'name' => 'my-instance',
'api_keys' => [
'key1',
'key2'
],
'auth_enabled' => false,
'command' => [
'nginx',
'-g',
'daemon off;'
],
'credentials_name' => 'dockerhub',
'description' => 'My first instance',
'envs' => [
'DEBUG_MODE' => 'False',
'KEY' => '12345'
],
'ingress_opts' => [
'disable_response_buffering' => true
],
'logging' => [
'destination_region_id' => 1,
'enabled' => true,
'retention_policy' => [
'period' => 42
],
'topic_name' => 'my-log-name'
],
'probes' => [
'liveness_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
],
'readiness_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
],
'startup_probe' => [
'enabled' => true,
'probe' => [
'exec' => [
'command' => [
'ls',
'-l'
]
],
'failure_threshold' => 3,
'http_get' => [
'port' => 80,
'headers' => [
'Authorization' => 'Bearer token 123'
],
'host' => '127.0.0.1',
'path' => '/healthz',
'schema' => 'HTTP'
],
'initial_delay_seconds' => 0,
'period_seconds' => 5,
'success_threshold' => 1,
'tcp_socket' => [
'port' => 80
],
'timeout_seconds' => 1
]
]
],
'timeout' => 120
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.gcore.com/cloud/v3/inference/{project_id}/deployments"
payload := strings.NewReader("{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.gcore.com/cloud/v3/inference/{project_id}/deployments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v3/inference/{project_id}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"containers\": [\n {\n \"region_id\": 1,\n \"scale\": {\n \"cooldown_period\": 60,\n \"max\": 3,\n \"min\": 1,\n \"triggers\": {\n \"cpu\": {\n \"threshold\": 80\n },\n \"memory\": {\n \"threshold\": 70\n }\n }\n }\n }\n ],\n \"flavor_name\": \"inference-16vcpu-232gib-1xh100-80gb\",\n \"image\": \"nginx:latest\",\n \"listening_port\": 80,\n \"name\": \"my-instance\",\n \"api_keys\": [\n \"key1\",\n \"key2\"\n ],\n \"auth_enabled\": false,\n \"command\": [\n \"nginx\",\n \"-g\",\n \"daemon off;\"\n ],\n \"credentials_name\": \"dockerhub\",\n \"description\": \"My first instance\",\n \"envs\": {\n \"DEBUG_MODE\": \"False\",\n \"KEY\": \"12345\"\n },\n \"ingress_opts\": {\n \"disable_response_buffering\": true\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 42\n },\n \"topic_name\": \"my-log-name\"\n },\n \"probes\": {\n \"liveness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"readiness_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n },\n \"startup_probe\": {\n \"enabled\": true,\n \"probe\": {\n \"exec\": {\n \"command\": [\n \"ls\",\n \"-l\"\n ]\n },\n \"failure_threshold\": 3,\n \"http_get\": {\n \"port\": 80,\n \"headers\": {\n \"Authorization\": \"Bearer token 123\"\n },\n \"host\": \"127.0.0.1\",\n \"path\": \"/healthz\",\n \"schema\": \"HTTP\"\n },\n \"initial_delay_seconds\": 0,\n \"period_seconds\": 5,\n \"success_threshold\": 1,\n \"tcp_socket\": {\n \"port\": 80\n },\n \"timeout_seconds\": 1\n }\n }\n },\n \"timeout\": 120\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234$abcdef
Path Parameters
Project ID
1
Body
List of containers for the inference instance.
1Show child attributes
Show child attributes
[
{
"region_id": 1,
"scale": {
"cooldown_period": 60,
"max": 3,
"min": 1,
"triggers": {
"cpu": { "threshold": 80 },
"memory": { "threshold": 70 }
}
}
}
]
Flavor name for the inference instance.
1"inference-16vcpu-232gib-1xh100-80gb"
Docker image for the inference instance. This field should contain the image name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to Docker Hub as the image registry, but any accessible Docker image URL can be specified.
^(?:(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*)(?::[A-Za-z0-9_][A-Za-z0-9_.-]{0,127})?$"nginx:latest"
Listening port for the inference instance.
1 <= x <= 6553580
Inference instance name.
4 - 30^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"my-instance"
List of API keys for the inference instance. Multiple keys can be attached to one deployment.If auth_enabled and api_keys are both specified, a ValidationError will be raised.
["key1", "key2"]
Set to true to enable API key authentication for the inference instance. "Authorization": "Bearer *****" or "X-Api-Key": "*****" header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use api_keys field instead.If auth_enabled and api_keys are both specified, a ValidationError will be raised.
false
Command to be executed when running a container from an image.
["nginx", "-g", "daemon off;"]
Registry credentials name
"dockerhub"
Inference instance description.
"My first instance"
Environment variables for the inference instance.
Show child attributes
Show child attributes
{ "DEBUG_MODE": "False", "KEY": "12345" }
Ingress options for the inference instance
Show child attributes
Show child attributes
{ "disable_response_buffering": true }
Logging configuration for the inference instance
Show child attributes
Show child attributes
{
"destination_region_id": 1,
"enabled": true,
"retention_policy": { "period": 42 },
"topic_name": "my-log-name"
}
Probes configured for all containers of the inference instance. If probes are not provided, and the image_name is from a the Model Catalog registry, the default probes will be used.
Show child attributes
Show child attributes
Specifies the duration in seconds without any requests after which the containers will be downscaled to their minimum scale value as defined by scale.min. If set, this helps in optimizing resource usage by reducing the number of container instances during periods of inactivity. The default value when the parameter is not set is 120.
x >= 0120
Response
OK
List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:
GET /v1/tasks/{task_id}- Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
["d478ae29-dedc-4869-82f0-96104425f565"]
Was this page helpful?