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

# Connect to remote AI compute

> Connect to Chowder Cloud or an existing remote endpoint with Python and environment-based client settings.

Chowder is local by default. Connect to **Chowder Cloud** for fully managed AI compute while keeping columnar SQL planning and inference-aware execution control in your application. This guide configures the client; the same settings also work with an existing self-hosted endpoint.

For account setup and your first managed workload, start with the [Chowder Cloud quickstart](https://docs.chowder.ai/cloud/quickstart.md). This guide covers the shared connection settings for Cloud and self-hosted endpoints.

## Use environment variables with chowder.sql()

Copy your Cloud API URL from Step 2 under **Get started** on your [Chowder Cloud dashboard](https://chowder.ai/dashboard). For self-hosted compute, use the URL provided by the server operator. Set these variables before launching Python or your notebook kernel.

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
export CHOWDER_REMOTE=1
export CHOWDER_API_URL="your-api-url"
export CHOWDER_API_TOKEN="your-api-token"
```

Call the module-level API directly. Use a notebook for rich display, or replace `chowder.display(result)` with `print(result)` in a terminal script:

```python theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
import chowder

SQL = """
SELECT
    source,
    page_number,
    content
FROM read_documents('hf://buckets/chowderai/chowder-demo/pdf/data/att-management-discussion-and-analysis-2020.pdf')
LIMIT 5
"""

relation = chowder.sql(SQL)
result = relation.to_polars()

chowder.display(result)
```

`chowder.sql()` uses a shared default engine. Set the environment before Chowder creates it. If the engine already exists, finish or cancel its work and call `chowder.close()` before your next query. You can also restart your notebook kernel and set the variables again. Call `chowder.close()` when you finish using the default engine.

## Select remote compute with Python

For explicit engine configuration and lifecycle control, set `CHOWDER_API_URL` and `CHOWDER_API_TOKEN` as shown above, then use `remote=True` to opt in for that engine.

```python theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
import chowder

SQL = """
SELECT
    source,
    page_number,
    content
FROM read_documents('hf://buckets/chowderai/chowder-demo/pdf/data/att-management-discussion-and-analysis-2020.pdf')
LIMIT 5
"""

engine = chowder.Engine(remote=True)

relation = engine.sql(SQL)
result = relation.to_polars()

chowder.display(result)

engine.close()
```

Set `CHOWDER_API_URL` when opting in with `CHOWDER_REMOTE=1` or `Engine(remote=True)`. If the URL is unset or blank, Chowder raises `ValueError` when creating the engine. You can also pass an explicit `location=` to select an endpoint and opt in for that engine.

## Keep control with Python

| Selection | Behavior |
| - | - |
| `Engine(remote=True)` | Use the endpoint in `CHOWDER_API_URL` unless you pass `location=` |
| `Engine(remote=False)` | Stay local even when `CHOWDER_REMOTE=1` |
| `Engine()` | Follow `CHOWDER_REMOTE`; stay local when it is unset or disabled |
| `Engine(location="...")` | Use that remote endpoint, overriding `CHOWDER_API_URL` |

Configuring a URL and token alone does not enable remote compute. `remote=False` cannot be combined with an explicit remote `location=`; contradictory settings raise a configuration error.

```python theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
engine = chowder.Engine(remote=False)

print(engine.status()["mode"])  # local

engine.close()
```

An explicit, nonblank `token=` overrides `CHOWDER_API_TOKEN`. Local engines do not use the remote credential.

## Connect to a self-hosted endpoint

The same client settings work with a self-hosted server. Set `CHOWDER_API_URL` to the endpoint provided by its operator and `CHOWDER_API_TOKEN` to your client credential, then opt in to remote compute as above. For example:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
export CHOWDER_API_URL="grpc+tls://compute.example.com:8816"
export CHOWDER_API_TOKEN="your-server-account-key"
```

If you want to operate the server yourself, follow [Self-host AI compute](https://docs.chowder.ai/guides/self-host-ai-compute.md) in Advanced.

## What stays local

* SQL parsing and planning
* AI-aware predicate ordering and `LIMIT` control
* Source discovery and local file access
* Native JSON, CSV, Parquet, and MCAP reads

Remote capabilities are negotiated when the engine connects. Unsupported operations fail explicitly instead of falling back to a different local model or execution path.


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