🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman
CLI and Python client for Vast.ai GPU cloud
This repo gives you a command-line client and Python SDK for the Vast.ai platform. You can search GPU offers, create and manage instances, and use the serverless client for endpoint inference from code or the terminal. It also ships skill files so coding agents can use the same workflows.
Builders who want to manage Vast.ai GPU resources from a CLI, Python code, or an agent skill.
You can launch, inspect, and stop Vast.ai instances without leaving your terminal or re-explaining the platform to your agent.
What it does
CLI for Vast.ai management
Commands like `search offers`, `create instance`, `show instances`, `stop instance`, and `destroy instance`.
Python SDK
A `VastAI` client for searching offers and managing instances from Python code.
Serverless client
An async `Serverless` client for endpoint lookup and request calls to Vast.ai serverless inference.
Agent skill files
Skill definitions in `vastai/SKILL.md` and `vastai_sdk/SKILL.md` for Claude Code, Cursor, Windsurf, Codex, and other agents.
SDK and CLI docs tooling
Scripts that generate, verify, and publish CLI and SDK docs from the OpenAPI and command definitions.
How to get it
- 1Linux, macOS, or WSL — install the CLI with no Python required
curl -fsSL https://vast.ai/install.sh | bash
- 2Windows, or using the Python SDK — install from PyPI instead
pip install vastai
- 3Set your API key
vastai set api-key YOUR_API_KEY
- 4Test a search
vastai search offers --limit 3
- 5The vastai command provides full access to the Vast.ai platform from your terminal
vastai search offers 'gpu_name=RTX_4090 num_gpus>=4' vastai create instance 12345 --image pytorch/pytorch --disk 32 --ssh --direct vastai show instances vastai stop instance 12345 vastai destroy instance 12345
- 6Run vastai --help for a full list of commands. You can also use --help on any subcommand
vastai search offers --help vastai create instance --help
README
Vast.ai Python SDK & CLI
The official Vast.ai Python package — provides both the CLI and SDK for managing Vast.ai GPU cloud resources, plus a serverless client for endpoint inference.
Install
Linux, macOS, or WSL — install the CLI with no Python required:
curl -fsSL https://vast.ai/install.sh | bash
This installs vastai into an isolated managed runtime under
~/.local/share/vastai, decoupled from any system or project Python. Update
anytime with vastai update, or pin/roll back with vastai update --version X.
Windows, or using the Python SDK — install from PyPI instead:
pip install vastai
Note:
pip install vastai-sdkalso works and installs the same package. Both package names are supported for backward compatibility.
Quickstart
-
Get your API key from https://cloud.vast.ai/manage-keys/
-
Set your API key:
vastai set api-key YOUR_API_KEY
- Test a search:
vastai search offers --limit 3
You should see a short list of available GPU offers.
CLI Usage
The vastai command provides full access to the Vast.ai platform from your terminal:
vastai search offers 'gpu_name=RTX_4090 num_gpus>=4'
vastai create instance 12345 --image pytorch/pytorch --disk 32 --ssh --direct
vastai show instances
vastai stop instance 12345
vastai destroy instance 12345
Run vastai --help for a full list of commands. You can also use --help on any subcommand:
vastai search offers --help
vastai create instance --help
SDK Usage
from vastai import VastAI
vast = VastAI() # uses VAST_API_KEY env var, or pass api_key="..."
vast.search_offers(query='gpu_name=RTX_4090 num_gpus>=4')
vast.show_instances()
vast.start_instance(id=12345)
vast.stop_instance(id=12345)
Use help(vast.search_offers) to view documentation for any method.
Migrating from
vastai-sdk? The old import still works:from vastai_sdk import VastAI
Using the Serverless Client
- Create the client
from vastai import Serverless
serverless = Serverless() # or, Serverless("YOUR_API_KEY")
- Get an endpoint
endpoint = await serverless.get_endpoint("my-endpoint")
- Make a request
request_body = {
"model": "Qwen/Qwen3-8B",
"prompt" : "Who are you?",
"max_tokens" : 100,
"temperature" : 0.7
}
response = await serverless.request("/v1/completions", request_body)
- Read the response
text = response["response"]["choices"][0]["text"]
print(text)
Find more examples in the examples/ directory.
Tab Completion
Tab completion is supported in Bash and Zsh via argcomplete (installed automatically). To enable it:
activate-global-python-argcomplete
Or for a single session:
eval "$(register-python-argcomplete vastai)"
AI Agents
Vast.ai has a skill for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.):
npx skills add vast-ai/vast-cli
This installs the Vast.ai skill so your agent can search offers, create instances, and manage GPU workflows directly. See CLI SKILL.md or SDK SKILL.md for the full reference.
Contributing
This repository is open source. If you find a bug, please open an issue. PRs are welcome.
Files in the repo
- .github
- docs
- examples
- openapi
- scripts
- sdk-wrapper
- tests
- vastai
- vastai_sdk
- .gitignore
- CLAUDE.md
- LICENSE
- poetry.lock
- pyproject.toml
- README.md
- vast_config.py
- vast.py
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More tools
The best-benchmarked open-source AI memory system. And it's free.
Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io
Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors
Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.