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

# GLM 概览

> 通过 PhanEdge 接入 GLM / Zhipu 文本模型，以及 OpenAI 和 Anthropic 兼容入口。

GLM 是智谱 / Zhipu 的模型系列。PhanEdge 当前为 GLM 提供两类常用接入方式：

* **OpenAI 兼容**：`POST /v1/chat/completions`
* **Anthropic 兼容**：`POST /v1/messages`

<Note>
  对大多数平台开发者，推荐先从 `/v1/chat/completions` 开始；只有当你的应用或 SDK 明确依赖 Anthropic Messages 协议时，再使用 `/v1/messages`。
</Note>

## 环境配置

```bash theme={null}
export BASE_URL="https://models.phanedge.cloud"
export TOKEN="your-phanedge-token"
```

## 快速体验

```bash theme={null}
curl "https://models.phanedge.cloud/v1/models" \
  -H "Authorization: Bearer $TOKEN"
```

## 常见模型

| 模型        | 说明                                                              |
| --------- | --------------------------------------------------------------- |
| `glm-4.7` | 通用文本模型，支持 OpenAI 兼容 `chat/completions` 与 GLM 原生 `web_search` 工具 |
| `glm-4.6` | 较早版本的文本模型                                                       |
| `glm-5`   | 新一代通用模型                                                         |
| `glm-5.1` | 新一代通用模型                                                         |

<Tip>
  实际可用模型以 `GET /v1/models` 和你当前 Token 的授权结果为准。
</Tip>

## 推荐入口

<CardGroup cols={2}>
  <Card title="Chat Completions" icon="comments" href="/glm/chat-completions">
    使用 OpenAI 兼容的对话补全接口接入 GLM。
  </Card>

  <Card title="联网搜索" icon="globe" href="/glm/web-search">
    使用 GLM 原生 `web_search` 工具，并理解 `search_query` 与返回的 `web_search` 字段。
  </Card>

  <Card title="Anthropic 兼容" icon="message" href="/glm/anthropic-compat">
    使用 `POST /v1/messages` 调用 GLM。
  </Card>

  <Card title="故障排查" icon="triangle-exclamation" href="/glm/troubleshooting">
    排查 `invalid_tool`、上游不可用、搜索结果不新鲜等常见问题。
  </Card>
</CardGroup>

## 兼容边界

* **OpenAI 兼容入口**：保留 GLM 的 `thinking` 与 `web_search` 原生工具字段。
* **Anthropic 兼容入口**：适合使用 Anthropic SDK 或 Messages API 协议的应用，但请按目标渠道验证工具与 thinking 扩展能力。
* **搜索结果证据**：当 GLM 上游返回搜索证据时，响应顶层会包含 `web_search` 数组。
