> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siflow.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# LibreChat

> 了解如何在 LibreChat 的 librechat.yaml 中配置 custom endpoints，接入 siflow endpoint，并使用算秩模型提供 ChatGPT-style UI。

[LibreChat](https://github.com/danny-avila/LibreChat) 是一个可自托管的开源 ChatGPT-style UI，支持多种 providers。它通过 `librechat.yaml` 中的 **custom endpoints** 功能访问 siflow endpoint。

本文默认模型为 `glm-5.2`；完整模型列表和价格请查看 [模型广场](https://console.siflow.cn/model-inference/models)。

请按照 [官方指南](https://www.librechat.ai/docs) 部署 LibreChat。

## 配置

LibreChat 的 providers 在服务端 `librechat.yaml` 中定义，而不是在 UI 中配置。在 [API 密钥](https://console.siflow.cn/model-inference/api_keys) 页面创建 API Key 后，添加 custom endpoint：

```yaml theme={null}
version: 1.2.1
cache: true
endpoints:
  custom:
    - name: "siflow"
      apiKey: "${SIFLOW_API_KEY}"
      baseURL: "https://api.siflow.cn/model-api/v1"
      models:
        default:
          - "glm-5.2"
        fetch: false
      titleConvo: true
      titleModel: "glm-5.2"
      modelDisplayLabel: "siflow"
```

| 字段               | 值                                                                               |
| ---------------- | ------------------------------------------------------------------------------- |
| `name`           | endpoint 选择器中显示的标签，例如 `siflow`                                                  |
| `apiKey`         | `${SIFLOW_API_KEY}`。请求时从环境变量解析                                                  |
| `baseURL`        | siflow OpenAI-compatible endpoint：`https://api.siflow.cn/model-api/v1`          |
| `models.default` | 要提供的模型 ID，例如 `glm-5.2`。如果要使用 LibreChat 的 agent/tool 功能，请选择原生支持 tool calling 的模型 |
| `models.fetch`   | `false`。如果当前接口不提供 OpenAI `/models` list format，请在此处列出模型，不要自动拉取                  |

在 LibreChat 可读取的环境中传入 key，例如 `.env` 或容器环境变量。请确认配置文件已被加载（`CONFIG_PATH=/path/to/librechat.yaml`，或默认 `./librechat.yaml`）：

```bash theme={null}
SIFLOW_API_KEY=<Your API Key>
```

## 验证

重启 LibreChat，登录后打开一个新 chat。在左上角 endpoint 选择器中选择 **siflow**（模型 `glm-5.2`），发送消息。如果返回正常回复，即表示连接成功。

<img src="https://mintcdn.com/siflow/CfO6jliU08Hhf849/model-inference/media/librechat-chat-reply.png?fit=max&auto=format&n=CfO6jliU08Hhf849&q=85&s=235b9d8fddde4aaf3b3ed418055d7fc4" alt="LibreChat 使用算秩 glm-5.2 模型返回对话回复" width="2982" height="1430" data-path="model-inference/media/librechat-chat-reply.png" />

LibreChat 没有用于添加 custom provider 的 UI，因此 endpoint 必须在配置文件中定义，而不是在设置页面中配置。
