> ## 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.

# LazyLLM

> 了解如何使用 LazyLLM 的 OnlineChatModule 配置自定义 OpenAI 兼容端点，接入 siflow endpoint，并构建低代码大模型应用。

[LazyLLM](https://github.com/LazyAGI/LazyLLM) 是商汤开源的低代码大模型应用开发框架。它的 `OnlineChatModule` 支持自定义 OpenAI 兼容端点，因此可以接入算秩模型推理服务。

本文以 `glm-5.2` 为例。完整模型清单与价格见 [模型广场](https://console.siflow.cn/model-inference/models)。

## 配置

在 [API 密钥](https://console.siflow.cn/model-inference/api_keys) 页面创建一个 API Key。安装 `lazyllm` 后，用 `source="openai"` 构建一个指向 siflow endpoint 的在线模型：

```python theme={null}
import lazyllm

m = lazyllm.OnlineChatModule(
    source="openai",
    model="glm-5.2",
    url="https://api.siflow.cn/model-api/v1",
    api_key="<您的 API Key>",
)
```

| 字段        | 说明                                                                            |
| --------- | ----------------------------------------------------------------------------- |
| `source`  | `openai` —— 走 OpenAI 兼容协议                                                     |
| `model`   | 算秩模型 ID，如 `glm-5.2`                                                           |
| `url`     | siflow OpenAI 兼容端点（base URL，含 `/v1`）：`https://api.siflow.cn/model-api/v1`     |
| `api_key` | 您在 [API 密钥](https://console.siflow.cn/model-inference/api_keys) 页面创建的 API Key |

## 验证

调用模型，能正常返回即接入成功（验证于 **lazyllm 1.3.0**）：

```python theme={null}
print(m("用一句话介绍你自己"))
```

## 常见问题

* **`source` 用 `openai`**，`url` 填 base URL 且含 `/v1`：`https://api.siflow.cn/model-api/v1`。
* **`model` 会透传给上游**：填错模型 ID 会收到上游 `404 model_not_found`，以 [模型广场](https://console.siflow.cn/model-inference/models) 的 ID 为准。
* 需要工具调用 / Agent 能力时，选用支持工具调用的模型（`glm-5.2` 可用）。
