vastai

Vast.ai CLI to manage GPU instances, volumes, serverless endpoints, and billing.

By vast-ai · 551 installs

npx skills add vast-ai/vast-cli --skill vastai

Source repository · Upstream listing

vastai Manage GPU instances, templates, volumes, serverless endpoints, SSH keys, and billing on Vast.ai. Command is vastai (lowercase). Always use raw for machine readable JSON output. Install Quick start API key: https://console.vast.ai/manage keys/ Global flags Available on every command: Query syntax Search commands accept filter expressions. Operators: = , != , , = , < , <= , in , notin . Common 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 Recommended 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 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 onstart or 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: If actual status becomes exited , unknown , or offline it will never reach running . 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 search offers flags: type on demand reserved bid , order/ o FIELD[ ] , limit , storage GB , no default/ n SSH & File Transfer Note: ssh url returns a connection string — it does not open an interactive session. Use $(vastai ssh url <id ) to extract the URL, or parse raw JSON output. File Copy cloud copy flags: src , dst , instance , connection , transfer Location formats: [instance id:]path (legacy), C.instance id:path , V.volume id:path , cloud service[.id]:path , local:path . Volume copy is currently only supported for copying to other volumes, instances, or cloud services, not local. Never copy to /root or / — it breaks ssh permissions on the instance and future copies fail. Logs & Exec Volumes Serverless & Deployments Templates Account & API Keys Billing Teams Environment Variables Machine Management (hosts) Common errors Error Cause Fix 401 Unauthorized Invalid or expired API key vastai set api key <new key Insufficient credits Account balance too low Add credits at https://cloud.vast.ai/billing/ No offers found Filters too restrictive Relax filters, try no default/ n Permission denied SSH key not attached vastai create ssh key before create instance Connection refused Instance not yet running Poll show instance <id until actual status == "running" Hangs on destroy instance Confirmation prompt waiting for input Add y flag: vastai destroy instance <id y URLs Console API Instance Ports Access a port exposed on your instance: Direct connections (when direct used at creation): <direct port end field in instance JSON. Documentation Fetch the complete documentation index at: https://docs.vast.ai/llms.txt