Vast.ai CLI
$ vastai Official High RiskVast.ai CLI (vastai) searches the Vast.ai GPU marketplace (vastai search offers), rents and destroys GPU instances (create instance, destroy instance), manages volumes, and prints SSH connection URLs (ssh-url). Passing --raw outputs raw machine-readable JSON across commands, alongside --explain for API debugging.
pip install vastai vastai exposes marketplace query filters and --raw JSON directly in the terminal for GPU provisioning and SSH setup.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Global --raw outputs JSON across search and instance commands, --api-key supports stateless runs, and query expressions filter offers server-side.
- Global
--rawJSON output acrosssearchandshowcommands - Inline query syntax (
gpu_name=...) and--explainflag
Lacks --dry-run; create instance starts immediate billing and destroy instance permanently wipes the instance.
- Immediate billing on
create instanceand irreversibledestroy instancewithout--dry-run
Installable via pip install vastai across macOS, Linux, and Windows, or standalone install.sh on macOS/Linux.
- PyPI package and standalone curl installer script
Rich query filtering (search offers), instance lifecycle, volume/S3 sync, and ssh-url helpers.
- Server-side offer filtering and
ssh-urlautomation
Official vast-ai/vast-cli repository under MIT license.
- Official
vast-ai/vast-clirepo (MIT)
Full CLI reference at docs.vast.ai and --help / --explain support.
- Official CLI reference at docs.vast.ai/api-reference/cli-commands
Security, Auth & Guardrails
vastai set api-key stores the key in ~/.config/vastai/vast_api_key (or accepts --api-key <key> per invocation).
MIT open-source CLI; renting instances incurs immediate per-hour GPU and storage marketplace charges.
# Vast.ai CLI Agent Rules - Always pass `--raw` on `search` and `show` queries for deterministic JSON parsing. - Never execute `vastai create instance` or `vastai destroy instance` without explicit user confirmation, as rentals bill immediately and destruction wipes disks.
Agent-Ready Command Recipes
Safe Read-Only Queries
vastai search offers 'gpu_name=RTX_4090 num_gpus=1 rentable=true' --raw
Queries rentable single-GPU RTX 4090 marketplace offers in structured JSON.
vastai show instances --raw
Returns current Vast.ai instances, status, costs, and SSH endpoints as JSON.
Controlled Writes & Previews
vastai stop instance <instance_id>
Stops GPU compute billing on an instance while retaining storage rather than destroying it.
Strengths for Agents
- + Global
--rawflag produces clean JSON across marketplace queries and instance inspection. - + Expressive server-side filtering (
'gpu_name=RTX_4090 num_gpus=1') avoids huge response payloads.
Caveats & Pitfalls
- ! No
--dry-runguard beforecreate instance(billing) ordestroy instance(data loss). - ! Default API key setup writes to
~/.config/vastai/vast_api_keyunless--api-keyis passed.