Skip to main content
POST
/
api
/
v0
/
template
/
create template
curl --request POST \
  --url https://console.vast.ai/api/v0/template/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "My Template",
  "image": "vastai/base-image",
  "tag": "@vastai-automatic-tag"
}'
{
  "success": true,
  "msg": "Template Created Successfully! New Template ID: 123456",
  "template": {
    "name": "<string>",
    "id": 123,
    "hash_id": "<string>"
  }
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
name
string
default:My Template
required

Name of the template

image
string
default:vastai/base-image
required

Docker image path. Used when launching instances from this template.

tag
string
default:@vastai-automatic-tag

Docker image tag specifying version of the image This can be included in the image instead of here

env
object

Environment variables

Example : { "HF_TOKEN": "hf_xxx123456789", "MODEL_ID": "TheBloke/Llama-2-7B-Chat-GPTQ", }

onstart
string

Commands to run when instance starts

Example : env | grep _ >> /etc/environment; echo 'starting up'

runtype
enum<string>

Type of instance runtime

Available options:
ssh,
jupyter,
args
ssh_direct
boolean

Enable direct SSH connection

jup_direct
boolean

Enable direct Jupyter connection

jupyter_dir
string

Directory to launch Jupyter from

Example : /home/notebooks

use_jupyter_lab
boolean

Use JupyterLab instead of Jupyter Notebook

docker_login_repo
string

Name of the private Docker repo (i.e docker.io)

docker_login_user
string

Username for private Docker repo

docker_login_pass
string

Access token or password for private Docker repo.

extra_filters
object

Additional machine search filters

Recommended disk space in GB. Defaults to 16GB if not specified.

Response

Template created or existing template found

success
boolean

Whether operation was successful

msg
string

Status message

Example:

"Template Created Successfully! New Template ID: 123456"

template
object

Template details