{
  "markdown": "# Vast.ai Python SDK & CLI\n[![PyPI version](https://badge.fury.io/py/vastai.svg)](https://badge.fury.io/py/vastai)\n\nProvides both the CLI and SDK for managing Vast.ai GPU cloud resources, plus a serverless client for endpoint inference.\n\n## Install\n\n**Linux, macOS, or WSL** — install the CLI with no Python required:\n\n```bash\ncurl -fsSL https://vast.ai/install.sh | bash\n```\n\nUpdate anytime with `vastai update`.\n\n**Windows, or using the Python SDK** — install from PyPI instead:\n\n```bash\npip install vastai\n```\n\n## Quickstart\n\n1. Get your API key from [https://cloud.vast.ai/manage-keys/](https://cloud.vast.ai/manage-keys/)\n\n2. Set your API key:\n```bash\nvastai set api-key YOUR_API_KEY\n```\n\n3. Test a search:\n```bash\nvastai search offers --limit 3\n```\nYou should see a short list of available GPU offers.\n\n## CLI Usage\n\nThe `vastai` command provides full access to the Vast.ai platform from your terminal:\n\n```bash\nvastai search offers 'gpu_name=RTX_4090 num_gpus>=4'\nvastai create instance 12345 --image pytorch/pytorch --disk 32 --ssh --direct\nvastai show instances\nvastai stop instance 12345\nvastai destroy instance 12345\n```\n\nRun `vastai --help` for a full list of commands. You can also use `--help` on any subcommand:\n\n```bash\nvastai search offers --help\nvastai create instance --help\n```\n\n## SDK Usage\n\n```python\nfrom vastai import VastAI\n\nvast = VastAI()  # uses VAST_API_KEY env var, or pass api_key=\"...\"\n\nvast.search_offers(query='gpu_name=RTX_4090 num_gpus>=4')\nvast.show_instances()\nvast.start_instance(id=12345)\nvast.stop_instance(id=12345)\n```\n\nUse `help(vast.search_offers)` to view documentation for any method.\n\n## Using the Serverless Client\n\n1. Create the client\n```python\nfrom vastai import Serverless\nserverless = Serverless() # or, Serverless(\"YOUR_API_KEY\")\n```\n2. Get an endpoint\n```python\nendpoint = await serverless.get_endpoint(\"my-endpoint\")\n```\n3. Make a request\n```python\nrequest_body = {\n    \"model\": \"Qwen/Qwen3-8B\",\n    \"prompt\" : \"Who are you?\",\n    \"max_tokens\" : 100,\n    \"temperature\" : 0.7\n}\nresponse = await serverless.request(\"/v1/completions\", request_body)\n```\n4. Read the response\n```python\ntext = response[\"response\"][\"choices\"][0][\"text\"]\nprint(text)\n```\n\nFind more examples in the `examples/` directory.\n\n## AI Agents\n\nVast.ai has a skill for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.):\n\n```bash\nnpx skills add vast-ai/vast-cli\n```\n\nThis installs the Vast.ai skill so your agent can search offers, create instances, and manage GPU workflows directly. See [CLI SKILL.md](vastai/SKILL.md) or [SDK SKILL.md](vastai_sdk/SKILL.md) for the full reference.\n\n## Contributing\n\nThis [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.\n",
  "bytes": 2812,
  "sha": "92adbd06f1bd047a504637ce6f765bca400d5d16ba25afca8d9ff6e4c8c9e822",
  "repo_slug": "vast-ai/vast-cli",
  "fonte": "repo",
  "truncated": false,
  "api": "https://api.agentalog.com/api/listings/skl_vast_ai_vast_cli_vastai_d8173822/readme"
}