> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-docs-screenshot-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# VastAI

The `VastAI` class is the main client for interacting with the Vast.ai platform. It wraps the CLI commands as Python methods with typed signatures.

## Installation

```bash theme={null}
pip install vastai
```

## Quick Start

```python theme={null}
from vastai import VastAI

client = VastAI(api_key="YOUR_API_KEY")

# Search for GPU offers
offers = client.search_offers(query="gpu_name=RTX_3090 rentable=True")
print(offers)

# Show your instances
instances = client.show_instances()
print(instances)
```

## Constructor

```python theme={null}
VastAI(
    api_key=None,
    server_url=None,
    retry=3,
    raw=False,
    explain=False,
    quiet=False,
    curl=False
)
```

<ParamField path="api_key" type="Optional[str]" default="None">
  Your Vast.ai API key. If not provided, reads from `~/.config/vastai/vast_api_key`.
</ParamField>

<ParamField path="server_url" type="Optional[str]" default="None">
  The Vast.ai API server URL. Defaults to `https://console.vast.ai` when unset.
</ParamField>

<ParamField path="retry" type="int" default="3">
  Number of retry attempts for failed API requests.
</ParamField>

<ParamField path="raw" type="bool" default="False">
  Return raw JSON responses instead of formatted output.
</ParamField>

<ParamField path="explain" type="bool" default="False">
  Print verbose explanations of API calls.
</ParamField>

<ParamField path="quiet" type="bool" default="False">
  Suppress non-essential output.
</ParamField>

<ParamField path="curl" type="bool" default="False">
  Print equivalent curl commands for API calls.
</ParamField>

<Note>If `api_key` is not provided, the `VastAI` class reads it from `~/.vast_api_key`.</Note>

## Getting Help

Use Python's built-in `help()` to view documentation for any method:

```python theme={null}
help(client.search_offers)
```
