# 🧑🎓 接入 ChatGLM

ChatGLM 是由清华开源的离线语言模型，你可以用自己的服务器来运行语言模型。

ChatGLM 的设置开始于一行 `[chatglm]` ，随后每个账号的设置开始于一行 `[[chatglm.accounts]]`。

**API 访问**

我们使用 ChatGLM 项目中 `api.py` 所提供的 Web API 来访问 ChatGLM。

```toml
[[chatglm.accounts]]
# ChatGLM 的接口地址，搭建方法见下
api_endpoint = "http://127.0.0.1:8000"
# 最大记忆的对话轮数
max_turns=10
# 请求超时时间（单位：秒）
timeout=360
```

**API 搭建方法**

```bash
# 下载项目
git clone https://github.com/THUDM/ChatGLM-6B.git
cd ChatGLM-6B
# 安装依赖
pip install -r requirements.txt
pip install fastapi uvicorn
# 启动
python api.py
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chatgpt-qq.lss233.com/pei-zhi-wen-jian-jiao-cheng/jie-ru-ai-ping-tai/jie-ru-chatglm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
