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

# Bring Your Own Model (BYOM)

> Configure a customer-owned Anthropic API key. Calls bypass Dacard credit metering.

Configure a customer-owned Anthropic API key. When BYOM is active, every model call (scoring, DAC chat, agents, recommendations) routes through the customer's key and bypasses Dacard credit metering. Available on Business and Enterprise.

## Read current status

```bash theme={null}
curl -X GET https://app.dacard.ai/api/settings/byom \
  -H "Authorization: Bearer $DACARD_API_KEY"
```

Response:

```json theme={null}
{
  "config": {
    "enabled": true,
    "provider": "anthropic",
    "lastValidatedAt": "2026-05-01T12:00:00Z",
    "keyPrefix": "sk-ant-..."
  },
  "planAllows": true
}
```

If no key is configured, `config` is `null`.

## Save or replace the key

```bash theme={null}
curl -X PUT https://app.dacard.ai/api/settings/byom \
  -H "Authorization: Bearer $DACARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "apiKey": "sk-ant-..." }'
```

The route validates the key against Anthropic before storing. The full key is encrypted at rest; only the prefix is returned in subsequent reads.

| Property                | Value                         |
| ----------------------- | ----------------------------- |
| **Auth**                | Required                      |
| **Required permission** | `account:manage_integrations` |
| **Required plan**       | Business or Enterprise        |
| **Idempotent**          | PUT yes (replaces).           |

## Body (PUT)

| Field    | Type   | Required | Notes                                                          |
| -------- | ------ | -------- | -------------------------------------------------------------- |
| `apiKey` | string | yes      | Anthropic API key, validated by a synthetic call to the model. |

## Errors

| Status | Code                        | When                                 |
| ------ | --------------------------- | ------------------------------------ |
| 400    | `Account required`          | Caller has no account.               |
| 400    | `Invalid Anthropic API key` | Validation against Anthropic failed. |
| 401    | `AUTH_REQUIRED`             | No session.                          |
| 403    | `FEATURE_GATED`             | Caller is on Free or Pro.            |
| 500    | `INTERNAL_ERROR`            | Encryption or DB write failed.       |

Audit log entries: `byom_enabled`, `byom_disabled`, `byom_key_replaced`.

## Disabling BYOM

`PATCH` with `{ "enabled": false }` keeps the key but pauses BYOM routing. `DELETE` removes the key entirely.
