> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/en/llms.txt
> - v0: https://docs.butterix.com/en/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/en/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# Update Ask AI settings

`PUT /sites/{site}/ai`

Requires the `admin` role. Only the fields you pass are updated.

- When `provider` changes without `model`, the model resets to that provider's default; without `apiKey`, the old key is removed (keys belong to a provider).
- `apiKey: null` removes the site's key and falls back to the platform key, if there is one. Keys are stored encrypted with AES-256-GCM.
- The levels `effort` can take come from the model (see `reasoning` in the [model list](https://docs.butterix.com/en/api-reference/ai/list-models.md)); an unsupported level is moved to the nearest one, and `null` uses the model's suggested level.
- `dailyLimit` caps questions that call the model in a rolling 24 hours (1–1000000); `null` means no limit, and the default is 200.

Base URL: https://api.butterix.com/v1

Authentication: bearer token in Authorization header or API key in cookie `biti_session`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | Site slug or id |

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | no |  |
| `provider` | enum | no | Allowed: `anthropic`, `deepseek`, `openrouter`. |
| `model` | string | no |  |
| `apiKey` | string | no | New key; `null` removes it May be null. |
| `guidance` | string | no | Guidance added to the system prompt |
| `effort` | enum | no | Reasoning effort; `null` uses the model's suggested level May be null. Allowed: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. |
| `dailyLimit` | integer | no | Maximum questions that call the model in a rolling 24 hours; `null` means no limit May be null. |
| `agent` | boolean | no | Switch for console AI (agent, scheduled tasks, AI translation, documentation gaps), independent of Ask AI |
| `gaps` | boolean | no | Sort documentation gaps every day |
| `support` | object | no | Contact when AI has no answer. Only the fields you send change; turning it on needs at least one way to reach you |
| `support.enabled` | boolean | no |  |
| `support.url` | string | no | Support page: an `https://` address or a path that starts with `/`; an empty string removes it |
| `support.email` | string | no | Support email; an empty string removes it |

## Example request

```bash
curl -X PUT https://api.butterix.com/v1/sites/acme-payments/ai \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
         "provider": "deepseek",
         "model": "deepseek-flash",
         "apiKey": "sk-xxxxxxxxxxxxxxxx"
       }'
```

## Responses

### 200

Updated settings

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | no |  |
| `provider` | enum | no | Allowed: `anthropic`, `deepseek`, `openrouter`. |
| `model` | string | no |  |
| `hasKey` | boolean | no | Whether a site key is set |
| `keyMasked` | string | no |  |
| `platformKeyAvailable` | boolean | no | Whether the platform has a default key for the current provider |
| `platformKeys` | map from strings to booleans | no | Whether each provider has a platform key |
| `guidance` | string | no |  |
| `effort` | enum | no | Reasoning effort; `null` uses the model's suggested level May be null. Allowed: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. |
| `retentionDays` | integer | no | Days to keep questions; `null` keeps them forever May be null. |
| `dailyLimit` | integer | no | Maximum questions that call the model in a rolling 24 hours; `null` means no limit May be null. |
| `agent` | boolean | no | Whether console AI is on |
| `gaps` | boolean | no | Whether documentation gaps are sorted every day |
| `support` | object | no | Contact when AI has no answer |
| `support.enabled` | boolean | no |  |
| `support.url` | string | no |  |
| `support.email` | string | no |  |

### Example response (200)

```json
{
  "enabled": true,
  "provider": "anthropic",
  "model": "claude-opus-5-5",
  "hasKey": true,
  "keyMasked": "sk-a…9f2c",
  "platformKeyAvailable": true,
  "platformKeys": {
    "key": true
  },
  "guidance": "string",
  "effort": "none",
  "retentionDays": 1,
  "dailyLimit": 200,
  "agent": true,
  "gaps": false,
  "support": {
    "enabled": false,
    "url": "",
    "email": ""
  }
}
```
