create_instance
Rent a GPU instance from Vast.ai by providing an offer ID and either an image or template, with optional spot pricing and startup commands.
Instructions
Rent a GPU by accepting offer_id (PUT /asks/{offer_id}/).
Either image or template_hash_id must be provided. Use price to create
an interruptible (spot) instance; omit it for on-demand.
env is a flat dict: regular vars as key/value pairs, port mappings as
{"-p 8000:8000": "1"}. Use onstart to launch your app on SSH/Jupyter
runtypes (their entrypoint is replaced by Vast's).
Examples: create_instance(offer_id=12345678, image="ubuntu:22.04", disk=16, runtype="ssh_direct") create_instance(offer_id=12345678, image="vllm/vllm-openai:latest", disk=50, runtype="ssh_direct", env={"MODEL_ID": "deepseek-ai/DeepSeek-R1-Distill-Llama-8B", "-p 8000:8000": "1"}, onstart="vllm serve $MODEL_ID --port 8000") create_instance(offer_id=12345678, template_hash_id="4e17788f74f075dd9aab7d0d4427968f", disk=100) create_instance(offer_id=12345678, image="ubuntu:22.04", disk=16, runtype="ssh_direct", price=0.20)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | ||
| disk | No | ||
| image | No | ||
| label | No | ||
| price | No | ||
| onstart | No | ||
| runtype | No | ssh_direct | |
| args_str | No | ||
| offer_id | Yes | ||
| image_login | No | ||
| jupyter_dir | No | ||
| volume_info | No | ||
| use_jupyter_lab | No | ||
| template_hash_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||