# 工作区式大语言模型设置端点状态

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

设置指定大语言模型端点的在线或离线状态。


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

## 调用前准备

`BASE_URL` 使用产品 API 前缀 `https://api.moi.matrixorigin.cn/v5`；专有部署填写对应的产品 API 地址。

[配置同环境身份、工作区与对象权限](objects.md#prepare)。

## 请求

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} 输入示例

```bash
curl --include --request PUT \
  "$BASE_URL/workspaces/$WORKSPACE_ID/llm/backends/$BACKEND_ID/endpoints/$ENDPOINT_ID/status" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"status":1}'
```

:::::
:::::{tab-item} 参数说明

| 参数 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | 请求头 | string | 是 | 同环境工作区 ID。 |
| `workspace_id` | 路径 | string | 是 | 同环境工作区 ID。 |
| `backend_id` | 路径 | integer | 是 | 由前序读取返回的正数 ID。 |
| `endpoint_id` | 路径 | integer | 是 | 由前序读取返回的正数 ID。 |
| `status` | 请求体 | integer | 否 | 0 在线，1 离线；省略/null 为 0，其他整数拒绝。 |

需要后端 update；目标由路径 backend_id/endpoint_id 决定，请求体的重复 ID 不替代路径。Embedding DAO 可能把零匹配当成功，必须回查；

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

## 成功响应

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```http
HTTP/1.1 204 No Content
```

:::::
:::::{tab-item} 字段说明

HTTP 204。

HTTP 204 没有响应体。

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

## 错误响应

[错误与结果确认](objects.md#errors)按两套协议区分。省略字段、SDK 零值和 HTTP 空响应分别解析，写后使用对应读取动作确认。
