> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/client.md).

# Client configuration

## Sync client

```python
from layerlens import Stratix

client = Stratix() # picks up LAYERLENS_STRATIX_API_KEY
client = Stratix(api_key="your-key") # explicit
```

## Async client

```python
from layerlens import AsyncStratix
client = AsyncStratix()
```

## Aliases

For backward compatibility:

```python
from layerlens import Stratix, AsyncStratix # primary
from layerlens import Client, AsyncClient # aliases
from layerlens import Atlas, AsyncAtlas # legacy aliases
from layerlens import PublicClient, AsyncPublicClient
```

## Constructor parameters

`Stratix(api_key, base_url, timeout, max_retries)` and `AsyncStratix(...)`:

| Parameter     | Type                             | Required | Default           | Description            |
| ------------- | -------------------------------- | -------- | ----------------- | ---------------------- |
| `api_key`     | `str \| None`                    | yes\*    | `None`            | Stratix API key        |
| `base_url`    | `str \| httpx.URL \| None`       | no       | Stratix API URL   | Custom base URL        |
| `timeout`     | `float \| httpx.Timeout \| None` | no       | 10 minutes (600s) | Timeout config         |
| `max_retries` | `int`                            | no       | `2`               | Max retries (429, 5xx) |

\*Required unless set via env var.

## Environment variables

| Variable                     | Default                           | Notes                              |
| ---------------------------- | --------------------------------- | ---------------------------------- |
| `LAYERLENS_STRATIX_API_KEY`  | (required)                        | Primary key env var                |
| `LAYERLENS_STRATIX_BASE_URL` | `https://api.layerlens.ai/api/v1` | Override for self-hosted / staging |
| `LAYERLENS_ATLAS_API_KEY`    | —                                 | Legacy alias                       |
| `LAYERLENS_ATLAS_BASE_URL`   | —                                 | Legacy alias                       |

## Timeout

```python
client = Stratix(timeout=30.0) # 30 seconds for all requests
client = Stratix(timeout=10*60) # 10 minutes (default)
```

## Per-request override

`.with_options()` returns a copy of the client with overridden options:

```python
result = client.with_options(timeout=300.0).evaluations.create(model=..., benchmark=...)
```

## Retries

The client retries on **429, 500, 502, 503, 504** with exponential backoff and respects `Retry-After`:

```python
client = Stratix(max_retries=5) # for batch-heavy workloads
client = Stratix(max_retries=0) # disable
```

## See also

* [Errors](/more-in-this-section-9/errors-1.md) — exception hierarchy
* [Authentication](/more-in-this-section-9/authentication.md)
* [Public client](/more-in-this-section-9/public-client.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layerlens.ai/more-in-this-section-9/client.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
