---
title: "Store (upsert) your own provider LLM key"
method: PUT
path: "/v1/llm/keys/{provider}"
tags: ["keys"]
---

# Store (upsert) your own provider LLM key

`PUT /v1/llm/keys/{provider}`

Scope: `llm_keys`. Requires a live API key; sandbox keys cannot modify the production credential store. Stores the caller's own Anthropic/OpenAI API key for BYOK, AES-256-GCM encrypted at rest. The plaintext key exists only in this request body; every response carries only the non-secret sha256-prefix `key_fingerprint` — the key is never returned, logged, or echoed again. Naturally idempotent (an upsert), so no Idempotency-Key is needed.

## Request body

- StoreLlmKeyRequest
  - `api_key` string, required — Your own provider API key (sk-ant-... for anthropic, sk-... for openai). AES-256-GCM encrypted at rest; never returned or logged.

## Response `200`

Key stored (fingerprint only; the key is never returned again).

- StoreLlmKeyResponse
  - `provider` 'anthropic' | 'openai', required
  - `key_fingerprint` string, required — Non-secret 12-lowercase-hex SHA-256 prefix fingerprint of the stored key. The key itself is never returned again.
  - `stored` true, required

## Other responses

- `400` — Invalid request body or parameters.
- `401` — Missing, invalid, or revoked API key. Pass `X-API-Key: sk-coasty-live-...` (or test).
- `403` — API key lacks the required scope or tier-feature is unavailable on the caller's plan.
- `404` — Resource not found in this key's namespace.
- `409` — The resource state conflicts with this operation.
- `413` — The request body exceeds the endpoint limit.
- `422` — The JSON shape is valid but one or more values violate the endpoint contract.
- `429` — Rate or concurrency limit exceeded.
- `500` — Unexpected server error. Retry with exponential backoff.
- `502` — An upstream dependency returned an invalid response.
- `503` — A required service is temporarily unavailable.
- `504` — An upstream dependency timed out.

---

[API](https://skmtc.net/coasty/apis/coasty-public-api.md) · [All operations](https://skmtc.net/coasty/apis/coasty-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coasty/coasty-public-api/revisions/f50d93b0d8a1/schema)
