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

# Recipe: Bring your own Anthropic key

> Run agents on your own Anthropic account — your usage, your billing, your model choice.

By default, agents use mapping.travel's hosted Anthropic credentials. If you'd rather have the LLM usage billed directly to your account — for compliance, cost control, or to use a model not on our hosted allow-list — switch to **BYO Anthropic key**.

## What changes

| Behaviour       | Hosted                                                     | BYO Anthropic                                       |
| --------------- | ---------------------------------------------------------- | --------------------------------------------------- |
| Who is billed   | mapping.travel (counted against your Pro Max subscription) | You, by Anthropic, directly                         |
| Daily spend cap | Still enforced (cents)                                     | Still enforced (cents, estimated from token counts) |
| Model selection | `claude-opus-4-7`, `claude-haiku-4-5-20251001`             | Any `claude-*` your account has access to           |
| Prompt caching  | Enabled                                                    | Enabled (Anthropic-native)                          |

## Steps

<Steps>
  <Step title="Create the key in the Anthropic Console">
    [console.anthropic.com](https://console.anthropic.com) → **API Keys → Create Key**. Name it *"mapping-travel-agents"*. Copy the value (`sk-ant-...`).
  </Step>

  <Step title="Store it in mapping.travel">
    **Agents → \[your agent] → Settings → LLM Provider.** Switch to **BYO Anthropic**. Paste the key. Click **Save** — we validate it with a low-cost `messages.create` ping before storing.
  </Step>

  <Step title="Pick a model">
    Any Anthropic model your account has access to. We recommend `claude-opus-4-7` for the default planning path; switch to `claude-haiku-4-5-20251001` for the fast path on routine cycles.
  </Step>

  <Step title="(Optional) Set a cap matching your Anthropic budget alert">
    The mapping.travel daily spend cap is still enforced (estimated from token counts), so you have two layers of protection.
  </Step>
</Steps>

## Equivalent API call

```bash theme={null}
curl -X PATCH https://api.mapping.travel/api/v1/agents/{id} \
  -H 'Authorization: Bearer mt_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "llmProvider": "BYO_ANTHROPIC",
    "llmModel": "claude-opus-4-7",
    "byoApiKey": "sk-ant-..."
  }'
```

The API stores the key in the secret vault, returns `byoKeySecretId`, and never echoes the plaintext key back.

## Security

* The key lives in the same vault as other workspace secrets (data-source credentials, Stripe webhook signing secrets).
* It is **only** visible to `OWNER` and `ADMIN` users; redacted (`sk-ant-****1234`) everywhere else, including the audit log.
* Rotating the key: paste the new value over the old one — we re-validate before swapping.

## Reverting to hosted

Switch the provider back to **Hosted Anthropic** in Settings. The BYO key is deleted from the vault; the audit log records `AGENT_UPDATED` with the provider change.

## Related

* [Agents overview](/agents/overview) — broader context.
* [Cost and limits](/agents/cost-and-limits) — caps are still enforced on BYO.
* [Configuration reference](/agents/configuration-reference#llm-provider) — full field list.
