Set Agent BYOK Model

Agents

Set Agent BYOK Model

Chooses which model of your own LLM key this agent runs. It must be one the key reaches — listed under byok.models by List Models — or null to run the key's own model (the one set under Settings → Your keys). The next reply uses it. A build key may do this.

PUT/agents/{id}/byok-model

Path parameters

idstringrequired
The agent's id (ag_…), as List Agents returns it. Another workspace's agent is the same 404 as one that never existed.

Headers

Katexs-Workspacestring
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace. Refused with 404 (Workspace not found.) when the id is unknown, is not one of your customers, or is not an org_… id; 410 when that customer was deleted (restore it with POST /customers/{id}/restore until it is erased); 403 when the key belongs to one customer workspace (it cannot act as another); 400 when your workspace is not a developer workspace. /customers/* and GET /customers/usage are your own workspace's and refuse the header with 400: call them without it.

Request body

modelstring | nullrequired
A model your LLM key reaches (List Models, byok.models), or null for the key's own model.

Example request

bash
curl -X PUT "https://app.katexs.com/api/v1/agents/{id}/byok-model" \
  -H "Authorization: Bearer $KATEXS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-5.4-mini"
}'

Responses

StatusDescription
200The model saved on the agent.
400model is missing, not a model id, or not one your key reaches.
401The key is missing, wrong or revoked. The answer is always the same, whichever it is.
403The key's access level (read-only or build) does not allow this request, the plan does not include it, or a customer's key named another workspace in Katexs-Workspace. code says which: key_scope_read, key_scope_build, workspace_header_forbidden, or forbidden.
404No such agent in your workspace.
409The workspace is not using its own language-model key: it brings no keys, or only its voice (scope voice). A workspace on llm, llm_voice or all can set an agent's model.
410The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date.
429Over a per-minute limit. Wait for Retry-After seconds. code and limit say which limit: rate_limit_resources (240 requests a minute for the workspace), rate_limit_family (2,400 across a developer's customers), rate_limit_calls, rate_limit_messages, rate_limit_codes, rate_limit_code_recipient, concurrent_calls or number_daily_limit.

Response fields

modelstring | nullrequired
The model saved on the agent, or null for the key's own.
200 response
{
  "model": "gpt-5.4-mini"
}

Last updated November 2026 · Found a problem? Email support@katexs.com