<span id="工作区式大语言模型更新后端"></span>

# Update an LLM backend through the workspace API

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Change a specified LLM backend's name, declared models, and supported configuration fields.


```http
PUT https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/llm/backends/{backend_id}
```

<span id="调用前准备"></span>

## Before you call this API

Set `BASE_URL` to the product API prefix `https://api.moi.matrixorigin.cn/v5`; use the corresponding product API URL for a dedicated deployment.

[Configure identity, workspace, and object permissions in the same environment](objects.md#prepare).

<span id="请求"></span>

## Request

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --request PUT \
  "$BASE_URL/workspaces/$WORKSPACE_ID/llm/backends/$BACKEND_ID" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"name":"更新后","reasoning_control_protocol":0,"origin_ref":"","origin_version":""}'
```

:::::
:::::{tab-item} Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | Headers | string | Yes | Workspace ID in the same environment. |
| `workspace_id` | Path | string | Yes | Workspace ID in the same environment. |
| `backend_id` | Path | integer | Yes | Positive ID returned by a preceding read. |
| `name` | Body | string | No | Omission, null, empty strings, or whitespace-only strings retain the old name. |
| `api_key_encrypted` | Body | string | No | Nonempty values replace it. Omission, null, or empty values retain it; empty values cannot clear credentials. |
| `timeout_seconds` | Body | integer | No | Updates only for a positive number. Omission, null, or nonpositive values retain it. |
| `models` | Body | array (strings) or null | No | Omission/null retain values; [] clears them; a nonempty array replaces all values. |
| `reasoning_control_protocol` | Body | integer or null | No | LLM only: omission/null retain it; 0 explicitly resets NONE; other valid values are 1–5. |
| `provider_origin` | Body | string or null | No | LLM only: omission/null retain it. Only external_provider is accepted explicitly; empty strings rejected. |
| `origin_ref` | Body | string or null | No | LLM only: omission/null retain it; an empty string clears it. |
| `origin_version` | Body | string or null | No | LLM only: omission/null retain it; an empty string clears it. |

Requires object model_backend.update. Type is absent from the update structure. No business request_id/CAS protection is supported. Reread required fields after writing. Current dedicated Go/Python/CLI clients omit models=[]. Use a call that preserves the complete HTTP array for clearing. An omitted empty models response field may also mean an empty set.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 0,
  "data": {
    "id": 12,
    "name": "更新后",
    "timeout_seconds": 120,
    "models": [
      "chat-example"
    ],
    "created_at": 1794445200,
    "updated_at": 1794445200,
    "provider_origin": "external_provider",
    "api_key_encrypted": "provider-key-example"
  }
}
```

:::::
:::::{tab-item} Fields

HTTP 200。

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | [Actual objects for this protocol](objects.md#responses). |

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error responses

[Errors and result confirmation](objects.md#errors) distinguishes the two protocols. Parse omitted fields, SDK zero values, and empty HTTP responses separately. Confirm writes with the corresponding reads.
