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

# Bring Your Own LLM

> Route a workspace's chat through your own OpenRouter key and model.

By default, a workspace's playground/chat uses the platform's default model. Set a per-workspace **OpenRouter** API key to route that workspace's chat through your own OpenRouter account, and (optionally) choose the model.

This is configured on the workspace endpoints (`POST /api/v1/mcp/workspaces` and `PATCH /api/v1/mcp/workspaces/{id}`). The environment (sandbox/production) is always derived from the API key — `sk_test_*` keys operate on sandbox, `sk_live_*` on production.

<Note>
  Looking to disable server-side conversation storage and supply prior turns yourself? See the [Stateless Chat](/guides/stateless-chat) guide.
</Note>

## Set the key on create

```bash theme={null}
curl -X POST https://api.routemcp.io/api/v1/mcp/workspaces \
  -H "Authorization: Bearer sk_test_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Bot",
    "integrations": ["github", "gmail"],
    "openRouterApiKey": "sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxx",
    "model": "anthropic/claude-sonnet-4-6"
  }'
```

## Update the key or model later

```bash theme={null}
curl -X PATCH https://api.routemcp.io/api/v1/mcp/workspaces/{id} \
  -H "Authorization: Bearer sk_test_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.5-flash"
  }'
```

The dashboard exposes the same controls in the workspace's **AI Config** card.

## Field reference

| Field              | Type   | Notes                                                                                                                                            |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `openRouterApiKey` | string | **Write-only.** Validated and encrypted at rest; **never returned** in any response. Setting it replaces the workspace's existing key. Optional. |
| `model`            | string | OpenRouter model id in `vendor/model` format (e.g. `anthropic/claude-sonnet-4-6`, `google/gemini-3.5-flash`). Optional.                          |

<Warning>
  `openRouterApiKey` is **input-only**. It is never echoed in create/get/update/list responses. To inspect the current configuration, read the `llm` status object (below). To remove a key, call `DELETE /api/v1/mcp/workspaces/{id}/llm-key`.
</Warning>

## Platform fallback

When no `openRouterApiKey` is configured on a workspace, chat falls back to the **platform's default model** — you don't have to set a key to use chat at all.

## The `llm` status object

Create, get, and update responses (and each list item) include an `llm` object describing the workspace's BYO LLM state. The key itself is never present here.

```json theme={null}
{
  "data": {
    "id": "0191e6a2-1c4d-7a3b-9f10-2b3c4d5e6f70",
    "name": "Support Bot",
    "statelessMode": false,
    "llm": {
      "configured": true,
      "model": "anthropic/claude-sonnet-4-6",
      "verificationStatus": "verified",
      "verifiedAt": "2026-05-29T10:05:00.000Z",
      "updatedAt": "2026-05-29T10:05:00.000Z"
    }
  }
}
```

| Field                | Type                                                  | Meaning                                                                                                                   |
| -------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `configured`         | boolean                                               | Whether a per-workspace OpenRouter key is set.                                                                            |
| `model`              | string \| null                                        | The configured OpenRouter model id, or `null` when none is set.                                                           |
| `verificationStatus` | `"verified"` \| `"invalid"` \| `"unverified"` \| null | `verified` — the key works; `invalid` — the key was rejected; `unverified` — not yet checked; `null` — no key configured. |
| `verifiedAt`         | string \| null                                        | When the key was last successfully verified, if ever.                                                                     |
| `updatedAt`          | string \| null                                        | When the LLM key/model was last changed.                                                                                  |

<Note>
  RouteMCP currently supports **OpenRouter** only for bring-your-own LLM keys. Support for additional providers is in progress and coming soon.
</Note>
