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

# Settings API

> Manage OpenRouter API key and default LLM model.

# Settings API

Base path: `/api/v1/settings` · Requires `Authorization: Bearer <jwt>`

## GET /api/v1/settings

```json theme={null}
{
  "user_id": "uuid",
  "openrouter_api_key": "sk-or-masked",
  "default_model": "anthropic/claude-sonnet-4-6",
  "created_at": "2026-03-28T00:00:00Z"
}
```

> [!NOTE]
>
> The API key is always returned masked after the initial save.

## PUT /api/v1/settings

```json theme={null}
{ "openrouter_api_key": "sk-or-v1-xxxx", "default_model": "anthropic/claude-sonnet-4-6" }
```

```json theme={null}
{ "success": true, "message": "Settings updated successfully" }
```

## POST /api/v1/settings/validate-key

Rate limit: 10 req/min

```json theme={null}
{ "openrouter_api_key": "sk-or-v1-xxxx" }
```

**Valid:** `{ "valid": true, "credits_remaining": 4.82, "plan": "pay-as-you-go" }`

**Invalid:** `{ "valid": false, "error": "Invalid API key or insufficient credits" }`

## DELETE /api/v1/settings/api-key

```json theme={null}
{ "success": true, "message": "API key removed" }
```

## Error Handling

| Scenario | HTTP | Message |
| - | - | - |
| Invalid key format | `400` | Key must start with `sk-or-` |
| Key fails validation | `200` | `valid: false` |
| Invalid model ID | `422` | Please select a valid model |
| No key on pipeline run | `403` | Add your OpenRouter key in Settings first |


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