Vastai
Vast.ai CLI to manage GPU instances, volumes, serverless endpoints, and billing.
- Skill ID
- vast-ai/vast-cli/vastai
- Publisher
- vast-ai
- Repository
- vast-cli
- Installs
- 0
- Files
- 97
- Requires
- Linux, macOS
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
vast-ai/vast-cli/vastaiInstalls these files- SKILL.md
- __init__.py
- _base.py
- api/__init__.py
- api/auth.py
- api/billing.py
- api/client.py
- api/clusters.py
- api/deployments.py
- api/endpoints.py
- api/instances.py
- api/keys.py
- api/machines.py
- api/metrics.py
- api/offers.py
- api/price_increase.py
- api/query.py
- api/storage.py
- api/teams.py
- async_/__init__.py
- async_/client.py
- async_/results.py
- cli/__init__.py
- cli/commands/__init__.py
- cli/commands/auth.py
- cli/commands/benchmarks.py
- cli/commands/billing.py
- cli/commands/clusters.py
- cli/commands/deployments.py
- cli/commands/endpoints.py
- cli/commands/instances.py
- cli/commands/keys.py
- cli/commands/machines.py
- cli/commands/metrics.py
- cli/commands/misc.py
- cli/commands/offers.py
- cli/commands/price_increase.py
- cli/commands/repl.py
- cli/commands/storage.py
- cli/commands/teams.py
- cli/commands/uninstall.py
- cli/commands/update.py
- cli/display.py
- cli/main.py
- cli/parser.py
- cli/repl/__init__.py
- cli/repl/bridge.py
- cli/repl/catalog.py
- cli/repl/completion.py
- cli/repl/session.py
- cli/self_test/__init__.py
- cli/self_test/machine_diagnostics.py
- cli/self_test/runtime_diagnostics.py
- cli/self_test/support_bundle.py
- cli/selfupdate.py
- cli/util.py
- cli/utils.py
- data/__init__.py
- data/deployment.py
- data/endpoint.py
- data/instance.py
- data/offer.py
- data/query.py
- data/workergroup.py
- pdf/__init__.py
- pdf/vast.ai-logo-50pct.png
- pdf/vast.ai-logo.png
- pdf/vast_pdf.py
- pdf/watcher.sh
- sdk.py
- serverless/__init__.py
- serverless/client/__init__.py
- serverless/client/client.py
- serverless/client/connection.py
- serverless/client/endpoint.py
- serverless/client/managed.py
- serverless/client/request_status.py
- serverless/client/session.py
- serverless/client/worker.py
- serverless/remote/__init__.py
- serverless/remote/base.py
- serverless/remote/deploy.py
- serverless/remote/serialization.py
- serverless/remote/serve.py
- serverless/remote/serve_deployment.py
- serverless/remote/utils.py
- serverless/server/__init__.py
- serverless/server/lib/__init__.py
- serverless/server/lib/backend.py
- serverless/server/lib/data_types.py
- serverless/server/lib/metrics.py
- serverless/server/lib/server.py
- serverless/server/worker.py
- sync/__init__.py
- sync/client.py
- sync/results.py
- utils.py
What this skill tells the agent
vastai
Manage GPU instances, templates, volumes, serverless endpoints, SSH keys, and billing on Vast.ai.
Command isvastai(lowercase). Always use--rawfor machine-readable JSON output.
Install
# Linux/macOS (recommended, no Python required)
curl -fsSL https://vast.ai/install.sh | bash
# or via PyPI (Windows, or if you'd rather use pip)
pip install vastaiQuick start
vastai set api-key <YOUR_API_KEY> # Authenticate (one-time); Create API Key in account at https://console.vast.ai/manage-keys/
vastai show user # Verify auth + check balance
vastai create ssh-key ~/.ssh/id_ed25519.pub # Register SSH key (do BEFORE create)
vastai search offers 'gpu_name=RTX_4090 num_gpus=1 verified=true direct_port_count>=1 rentable=true' -o 'dlperf_usd-'
# Note the offer ID from the output
vastai create instance <OFFER_ID> --image pytorch/pytorch:@vastai-automatic-tag --disk 20 --ssh --direct
# Automatically grab appropriate image tag; Response: {"success": true, "new_contract": <INSTANCE_ID>}
vastai show instance <INSTANCE_ID> # Poll until actual_status == "running" (see Instance status values below)
vastai ssh-url <INSTANCE_ID> # Get SSH connection string
vastai copy local:./data/ <INSTANCE_ID>:/workspace/ # Upload files
vastai destroy instance <INSTANCE_ID> -y # Clean up (stops all billing; -y skips confirmation)API key: https://console.vast.ai/manage-keys/
Global flags
Available on every command:
--api-key KEY Override stored API key
--raw Output machine-readable JSON (agents should always use this)
--full Print full results (don't page with less)
--explain Show underlying API calls (useful for debugging)
--curl Show equivalent curl command
--no-color Disable colored output
--url URL Override server REST API URL
--retry RETRY Set retry limit for API calls
--version Show CLI versionQuery syntax
Search commands accept filter expressions. Operators: =, !=, >, >=, <, <=, in, notin.
# Examples
'gpu_name=RTX_4090 num_gpus=1' # Exact match + numeric
'gpu_ram>=48 reliability>0.95' # Greater-than filters
'geolocation=EU dph_total<=2.0' # Region + price capCommon filter fields: num_gpus, gpu_name, gpu_ram, cpu_ram, disk_space, reliability, compute_cap, inet_up, inet_down, dph_total, geolocation, direct_port_count, verified, rentable
Common sort fields: score (default — overall value), dlperf_usd (DL perf per dollar), dph_total (price), num_gpus, reliability
Commands
Instances
vastai show instances # List all your instances (fetches every page, no prompts)
vastai show instances --status running loading # Filter by status
vastai show instances --gpu-name 'RTX 4090' # Filter by GPU
vastai show instances --label training # Filter by label
vastai show instances --order-by start_date desc # Sort by column
vastai show instances --cols id,status,gpu,dph # Custom columns
vastai show instances --raw # Flat JSON list of all instances (scripting)
vastai show instance <id> # Poll single instance (use for status checks)
vastai create instance <offer-id> --image pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime --disk 20 --ssh --direct
# Response includes "new_contract": <id> — that is your instance ID
vastai launch instance --gpu-name RTX_4090 --num-gpus 1 --image pytorch/pytorch
vastai start instance <id> # Start stopped instance
vastai stop instance <id> # Stop (preserves disk, no GPU charges)
vastai reboot instance <id> # Stop + start
vastai destroy instance <id> -y # Delete permanently (irreversible; -y required for non-interactive use)
vastai destroy instances <id1> <id2> -y # Batch delete (-y skips confirmation prompt)
vastai label instance <id> --label "training-run-1" # Tag instance
vastai update instance <id> # Recreate from updated template
vastai prepay instance <id> # Deposit credits into reserved instance
vastai recycle instance <id> # Destroy + recreateRecommended Vast.ai images (use @vastai-automatic-tag to get the right tag for the machine automatically; browse pre-configured models at https://vast.ai/model-library):
<!-- Note: @vastai-automatic-tag is resolved server-side — CLI passes it unchanged -->
vastai/base-image:@vastai-automatic-tag # Minimal Ubuntu base
vastai/pytorch:@vastai-automatic-tag # PyTorch + CUDA
vastai/linux-desktop:@vastai-automatic-tag # Linux desktop (VNC/RDP)
# vLLM — set model via env vars with huggingface model example
vastai create instance <id> --image vastai/vllm:@vastai-automatic-tag --disk 40 --ssh --direct \
--env '-e MODEL_NAME=Qwen/Qwen2.5-3B-Instruct -e HF_TOKEN=hf_xxx'
# ComfyUI — set model checkpoint via env vars with huggingface model example
vastai create instance <id> --image vastai/comfy:@vastai-automatic-tag --disk 40 --ssh --direct \
--env '-e CHECKPOINT_MODEL=black-forest-labs/FLUX.1-schnell -e HF_TOKEN=hf_xxx'create instance flags:
--image IMAGE— Docker image--disk DISK— Local disk in GB--ssh/--jupyter— Connection type--direct— Faster direct connections--label LABEL— Instance label--env ENV— Env vars and port mappings, e.g.'-e TZ=UTC -p 8080:8080'--onstart FILE— Path to a startup script file--onstart-cmd CMD— Startup script as inline string (for longer scripts use--onstartor gzip+base64 encode)--bid_price PRICE— Interruptible (spot) pricing in $/hr--template_hash HASH— Create from template--create-volume ID— Attach new volume--link-volume ID— Attach existing volume--cancel-unavail— Fail if no machine available (vs. create stopped)
Instance status values:
actual_status | Meaning |
|---|---|
null | Provisioning |
created | Instance created, not yet provisioned |
loading | Image downloading / container starting |
running | Active — GPU charges apply |
stopped | Halted — disk charges only |
frozen | Paused with memory — GPU charges apply |
exited | Container process exited unexpectedly |
rebooting | Restarting (transient) |
unknown | No recent heartbeat from host |
offline | Host disconnected from Vast servers |
Poll loop warning: Ifactual_statusbecomesexited,unknown, orofflineit will never reachrunning. Always add a timeout and error branch — otherwise your script loops forever while disk charges accrue. Destroy and retry with a different offer.
Charges: Storage charges begin at creation. GPU charges begin when status reaches running.Interruptible (spot) rentals
Interruptible (spot) instances are priced below on-demand instances, but can be interrupted at any time by another user with a lower bid. Note: search offers --type bid exposes min_bid, but create instance defaults to on-demand at `dph_total` unless you pass --bid_price <floor>. Always pass --bid_price after a --type bid search, otherwise the instance will be rented as an on-demand instance/price instead of as an interruptible.
When outbid, the instance moves to stopped (not destroyed) and storage charges continue. Resume by raising the bid via update instance --bid_price.
Search
vastai search offers # Default: verified, on-demand, sorted by scoreUse this skill in a project
Open any RiverX project, search the Skills panel for vast-ai/vast-cli/vastai, and install it in one click.
