Creates a new instance by accepting an “ask” contract from a provider.
template_id or template_hash_id is provided, those template defaults are either merged or overridden by parameters specified in the request body.Template Precedence Rules:
env: Merged by key. Request values win on key conflictsextra_filters: Merged by key. Request values win on key conflictsFor detailed template usage, see Creating and Using Templates with API.
CLI Usage: vastai create instance <offer_id> <image> [options]
API key must be provided in the Authorization header
ID of the offer to accept (ask_id)
Docker image to use for the instance.
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
Custom name for the instance
Size of local disk partition (in GB)
Launch mode for the instance. If omitted, defaults to 'ssh' unless args/args_str is provided.
ssh, jupyter, args, ssh_proxy, ssh_direct, jupyter_proxy, jupyter_direct Desired initial state of the instance
running, stopped Bid price per machine (in $/hour). Only for interruptible instances
0.001 <= x <= 128Environment 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"
Whether to cancel if instance cannot start immediately. Defaults to false for interruptibles. Defaults to true for on-demand with target_state='running'
Whether this is a VM instance
Commands to run when instance starts
Example : env | grep _ >> /etc/environment; echo 'starting up'
Arguments array to passed to the image entrypoint
Example : ["bash", "-c", "env | grep _ >> /etc/environment; echo 'starting up'"]
Arguments string to pass to the entrypoint (alternative to args)
Example : args_str: bash -c "env | grep _ >> /etc/environment; echo 'starting up'"
Launch instance with jupyter lab instead of notebook
Directory to launch Jupyter from
Example : /home/notebooks
Set python's locale to C.UTF-8
Set locale to C.UTF-8
Skip sanity checks when creating from an existing instance
User to use with docker create (breaks some images, use with caution)
Docker registry credentials if needed
Volume creation/linking information