---
title: "Reassign the agent's BYOK LLM key"
method: PATCH
path: "/agents/{id}/llm-key"
tags: ["Agents"]
---

# Reassign the agent's BYOK LLM key

`PATCH /agents/{id}/llm-key`

## Request

- Base URL: `https://api.atako.ai`
- URL: `https://api.atako.ai/agents/{id}/llm-key`
- Auth: HTTP bearer

Owner of the agent, or an admin of the owner's company. A plain teammate (who can still view and chat with the agent) gets 404. The key must belong to the AGENT's company, so this never reaches another user's personal key.

## Path parameters

- `id` string, required

## Request body

- object
  - `llmKeyId` string, uuid, nullable, required
  - `modelId` string: Weflayr model id (required when switching TO a Weflayr key; also when leaving Weflayr for an agent with no OpenRouter model).

## Response `200`

- object
  - `llmKeyId` string, uuid, nullable
  - `directModelId` string, nullable

## Other responses

- `400`: llmKeyId must be a string or null / PROVIDER_KEY_INVALID / MODEL_REQUIRED / Model not found / MODEL_CONTEXT_TOO_SMALL / DIRECT_PROVIDER_REASSIGNMENT_NOT_SUPPORTED
- `401`: Missing, malformed, or invalid bearer token / API key, or revoked session (SESSION_REVOKED).
- `403`: BYOK_DISABLED / BYOK_NOT_ALLOWED
- `404`: Unknown agent, or the caller is neither its owner nor an admin of the owner's company.

---

[API](https://skmtc.dev/atako/apis/atako-api.md) · [All operations](https://skmtc.dev/atako/apis/atako-api/llms.txt) · [OpenAPI document](https://skmtc.dev/atako/apis/atako-api/revisions/aa555c56fbd7?raw)
