Skip to main content
PUT
/
api
/
v0
/
asks
/
{id}
/
create instance
curl --request PUT \
  --url https://console.vast.ai/api/v0/asks/{id}/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "image": "vastai/base-image:@vastai-automatic-tag"
}'
{
  "success": true,
  "new_contract": 1234568
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Path Parameters

id
integer
required

ID of the offer to accept (ask_id)

Body

application/json
image
string
default:vastai/base-image:@vastai-automatic-tag
required

Docker image to use for the instance.

template_id
integer

ID of an existing template to use for instance configuration. Alternative to providing template_hash_id.

Example : 62897

template_hash_id
string

Hash ID of a template. Alternative to providing template_id

Example : 4e17788f74f075dd9aab7d0d4427968f

label
string

Custom name for the instance

disk
number

Size of local disk partition (in GB)

runtype
enum<string>

Launch mode for the instance. If omitted, defaults to 'ssh' unless args/args_str is provided.

Available options:
ssh,
jupyter,
args,
ssh_proxy,
ssh_direct,
jupyter_proxy,
jupyter_direct
target_state
enum<string>

Desired initial state of the instance

Available options:
running,
stopped
price
number

Bid price per machine (in $/hour). Only for interruptible instances

Required range: 0.001 <= x <= 128
env
object

Environment variables

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

cancel_unavail
boolean

Whether to cancel if instance cannot start immediately. Defaults to false for interruptibles. Defaults to true for on-demand with target_state='running'

vm
boolean

Whether this is a VM instance

onstart
string

Commands to run when instance starts

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

args
string[]

Arguments array to passed to the image entrypoint

Example : ["bash", "-c", "env | grep _ >> /etc/environment; echo 'starting up'"]

args_str
string

Arguments string to pass to the entrypoint (alternative to args)

Example : args_str: bash -c "env | grep _ >> /etc/environment; echo 'starting up'"

use_jupyter_lab
boolean

Launch instance with jupyter lab instead of notebook

jupyter_dir
string

Directory to launch Jupyter from

Example : /home/notebooks

python_utf8
boolean

Set python's locale to C.UTF-8

lang_utf8
boolean

Set locale to C.UTF-8

force
boolean

Skip sanity checks when creating from an existing instance

user
string

User to use with docker create (breaks some images, use with caution)

image_login
string

Docker registry credentials if needed

volume_info
object

Volume creation/linking information

Response

Instance created successfully

success
boolean

If the instance was created successfully

Example:

true

new_contract
integer

ID of the newly created instance contract

Example:

1234568