create instance
Creates a new instance by accepting an “ask” contract from a provider.
- Use the search offers endpoint to discover available machines.
- If
template_idis provided, those template defaults are either merged or overridden by parameters specified in the request body.
Template Precedence Rules:
- Scalar fields (image, disk, runtype, etc.): Request value overrides template value
env: Merged by key. Request values win on key conflictsextra_filters: Merged by key. Request values win on key conflicts
For detailed template usage, see Creating and Using Templates with API.
CLI Usage: vastai create instance <offer_id> <image> [options]
Documentation Index
Fetch the complete documentation index at: https://vastai-80aa3a82-auto-openapi-preview-pr-4175.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
API key must be provided in the Authorization header
Path Parameters
ID of the offer to accept (ask_id)
Body
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