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
}

Documentation Index

Fetch the complete documentation index at: https://vastai-80aa3a82-fix-google-validation-docs-404s.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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_hash_id
string

Content-based hash ID of a template to use as base configuration. Template values are merged with or overridden by request parameters (see precedence rules in endpoint description). When using a template, the image field is optional as the template provides it.

Example: 4e17788f74f075dd9aab7d0d4427968f

label
string

Custom name for the instance

disk
number<float>

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
string

Environment variables and port mappings in Docker flag format. When using a template, request env is merged with template env - existing keys are retained, new keys are appended, conflicting keys use the request value.

Example: "-e HF_TOKEN=hf_xxx123456789 -e MODEL_ID=TheBloke/Llama-2-7B-Chat-GPTQ -p 8000:8000"

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