export const frontmatter = {
  title: 'Configuration',
  description: 'Configure model settings and API keys.'
};

Configure model settings and API keys.

## Set defaults

```python
import vibe_widget as vw

vw.config(model="openai/gpt-5.1-codex")
vw.config(mode="premium", model="openrouter")
vw.config(execution="approve")
```

## API key setup

Get an OpenRouter API key:
https://openrouter.ai/

Need help setting API keys in Jupyter? See [this guide](https://docs.google.com/document/d/e/2PACX-1vST8sEHdo90NsTdTFNjLi27YFT-81u2WQa7--qr0u4yk2aByE6Q5WIj-p8JYueEING5-fNdFNu2Aa3t/pub).


```bash
export OPENROUTER_API_KEY='your-key'
```

```powershell
$env:OPENROUTER_API_KEY="your-key"
```

```python
import os
from dotenv import load_dotenv
import vibe_widget as vw

load_dotenv()
api_key = os.getenv("MY_SECRET_API_KEY")

vw.config(api_key=api_key)
```

We recommend avoiding hardcoded keys in notebooks to prevent accidental leaks.

## Models

```python
vw.models()
vw.models(show="all")
vw.models(verbose=False)
```

## Common configuration options

```python
vw.config(
    execution="auto",  # "auto" or "approve"
    retry=2,            # Runtime repair attempts
    agent_preset="project",
    agent_run={"tier": 1},
    bypass_row_guard=False,
)
```

## Privacy and telemetry

Vibe Widget sends the following to the model provider:

- your prompt and theme prompt
- data schema (column names, dtypes)
- a small sample of rows (up to 3)
- outputs/inputs descriptors
- full widget code for edits, audits, and runtime fixes
- runtime error messages (when auto-fixing)

No API keys are written to disk. Generated widgets and audit reports are stored locally in `.vibewidget/`.
