> For the complete documentation index, see [llms.txt](https://layerlens.gitbook.io/stratix-python-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layerlens.gitbook.io/stratix-python-sdk/getting-started/authentication.md).

# Authentication & Configuration

## API Key Setup

The SDK authenticates using an API key tied to your LayerLens organization. You can obtain your key from the [LayerLens dashboard](https://app.layerlens.ai).

### Environment Variable (Recommended)

Set the `LAYERLENS_STRATIX_API_KEY` environment variable and the client will pick it up automatically:

```bash
export LAYERLENS_STRATIX_API_KEY="your-api-key"
```

```python
from layerlens import Stratix

# Automatically reads from LAYERLENS_STRATIX_API_KEY
client = Stratix()
```

### Explicit API Key

Pass the key directly when constructing the client:

```python
from layerlens import Stratix

client = Stratix(api_key="your-api-key")
```

### Using a .env File

```bash
# .env (add this file to .gitignore)
LAYERLENS_STRATIX_API_KEY=your-api-key
```

```python
from dotenv import load_dotenv
load_dotenv()

from layerlens import Stratix
client = Stratix()
```

## Configuration Options

| Parameter  | Type                             | Default                           | Description     |
| ---------- | -------------------------------- | --------------------------------- | --------------- |
| `api_key`  | `str \| None`                    | `LAYERLENS_STRATIX_API_KEY` env   | Your API key    |
| `base_url` | `str \| httpx.URL \| None`       | `https://api.layerlens.ai/api/v1` | API base URL    |
| `timeout`  | `float \| httpx.Timeout \| None` | 10 minutes                        | Request timeout |

## Environment Variables

| Variable                     | Description               | Default                           |
| ---------------------------- | ------------------------- | --------------------------------- |
| `LAYERLENS_STRATIX_API_KEY`  | Your API key              | (required)                        |
| `LAYERLENS_STRATIX_BASE_URL` | Override the API base URL | `https://api.layerlens.ai/api/v1` |

Legacy environment variables (`LAYERLENS_ATLAS_API_KEY`, `LAYERLENS_ATLAS_BASE_URL`) are also supported for backward compatibility.

## Organization & Project

On initialization, the client fetches your organization and project IDs automatically using your API key. These are used to scope all API requests.

## Timeout Configuration

```python
# Global timeout (30 seconds)
client = Stratix(timeout=30.0)

# Per-request timeout override
evaluation = client.with_options(timeout=120.0).evaluations.create(
    model=model,
    benchmark=benchmark,
)
```


---

# 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://layerlens.gitbook.io/stratix-python-sdk/getting-started/authentication.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.
