vastai
vast-ai/vast-cli · skills.sh
Open source Repository Open in the app JSON README (API)
About
Skill publicada por vast-ai/vast-cli no skills.sh. Instale com: npx skills add vast-ai/vast-cli@vastai
Details
- Kind
- Agent skills
- Topic
- Developer tools
- Publisher
- vast-ai
- Origin
- skillssh
- Category
- ferramentas
- Stars
- 223
- Forks
- 95
- Open pull requests
- 36
- Last push
- 2026-10-07T20:26:21Z
- Repository state
- ativo
- Language
- Python
- License
- MIT
- Added
- 2026-10-06 04:44:52
- Updated
- 2026-10-06 04:44:52
- Origin id
vast-ai/vast-cli/vastai
README
# Vast.ai Python SDK & CLI
[](https://badge.fury.io/py/vastai)
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:
```bash
curl -fsSL https://vast.ai/install.sh | bash
```
Update anytime with `vastai update`.
**Windows, or using the Python SDK** — install from PyPI instead:
```bash
pip install vastai
```
## Quickstart
1. Get your API key from [https://cloud.vast.ai/manage-keys/](https://cloud.vast.ai/manage-keys/)
2. Set your API key:
```bash
vastai set api-key YOUR_API_KEY
```
3. Test a search:
```bash
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:
```bash
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:
```bash
vastai search offers --help
vastai create instance --help
```
## SDK Usage
```python
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.
## Using the Serverless Client
1. Create the client
```python
from vastai import Serverless
serverless = Serverless() # or, Serverless("YOUR_API_KEY")
```
2. Get an endpoint
```python
endpoint = await serverless.get_endpoint("my-endpoint")
```
3. Make a request
```python
request_body = {
"model": "Qwen/Qwen3-8B",
"prompt" : "Who are you?",
"max_tokens" : 100,
"temperature" : 0.7
}
response = await serverless.request("/v1/completions", request_body)
```
4. Read the response
```python
text = response["response"]["choices"][0]["text"]
print(text)
```
Find more examples in the `examples/` directory.
## AI Agents
Vast.ai has a skill for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.):
```bash
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](https://github.com/vast-ai/vast-cli/blob/HEAD/vastai/SKILL.md) or [SDK SKILL.md](https://github.com/vast-ai/vast-cli/blob/HEAD/vastai_sdk/SKILL.md) for the full reference.
## Contributing
This [repository](https://github.com/vast-ai/vast-cli) is open source. If you find a bug, please [open an issue](https://github.com/vast-ai/vast-cli/issues). PRs are welcome.