> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reygrid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Client options for the ReyGrid Python SDK: API key, base URL, headers, timeout, and custom httpx clients.

Pass options as keyword arguments, or as a single dict.

```python theme={"system"}
from reygrid import ReyGrid

client = ReyGrid(
    api_key="your-api-key",
    base_url="https://reygrid.com/api/v1",
    timeout=60.0,
    headers={"X-My-Header": "value"},
)

# Equivalent
client = ReyGrid({"api_key": "your-api-key", "timeout": 60.0})
```

## Options

| Option | Type | Default | Description |
| - | - | - | - |
| `api_key` | `str \| None` | `None` | Sent as `Authorization: Bearer <key>` |
| `base_url` | `str` | `https://reygrid.com/api/v1` | API base URL. A trailing `/` is removed |
| `headers` | `dict[str, str] \| None` | `None` | Extra default headers for every request |
| `timeout` | `float` | `60.0` | httpx timeout in seconds |
| `httpx_client` | `httpx.Client \| None` | auto | Your own sync client (proxies, shared connections, transports) |
| `httpx_async_client` | `httpx.AsyncClient \| None` | auto | Your own async client |

The SDK always sends `Accept: application/json` and `Content-Type: application/json` unless you override them in `headers`.

<Warning>
  Pass a dict or keyword arguments. The `ReyGridConfig` dataclass is exported, but the `ReyGrid` constructor does not accept an instance of it.
</Warning>

## Custom base URL

```python theme={"system"}
client = ReyGrid(
    api_key="your-api-key",
    base_url="https://custom-gateway.example.com/reygrid",
)
```

## Custom httpx client

```python theme={"system"}
import httpx
from reygrid import ReyGrid

client = ReyGrid(
    api_key="your-api-key",
    httpx_client=httpx.Client(proxy="http://proxy.local:8080", timeout=30),
)
```

<Note>
  If you supply `httpx_client` or `httpx_async_client`, the SDK uses it as-is. Headers and timeout from the SDK options are only applied to clients the SDK creates itself, so set the `Authorization` header on your own client.
</Note>

## Cleanup

```python theme={"system"}
client.close()          # sync
await client.aclose()   # async
```

`ReyGrid` also works as a context manager (`with` and `async with`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.