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

# GLM

> 智谱的 GLM 系列：可用型号、调用示例与计费方式。

智谱的 GLM 系列，从轻量到旗舰型号齐全。

* 接口：`POST https://token.poryf.com/v1/chat/completions`（OpenAI 格式），字段说明见 [创建对话](/api/chat)
* 在线试用需要登录，按自己的余额扣费

## 可用型号

| 模型 ID | 说明 | 链接 |
| - | - | - |
| `glm-5.3` | 最新旗舰 | [价格](https://token.poryf.com/pricing/glm-5.3) · [试用](https://token.poryf.com/model-guide/glm-5.3) |
| `glm-5.3-flashx` | 5.3 轻量版 | [价格](https://token.poryf.com/pricing/glm-5.3-flashx) · [试用](https://token.poryf.com/model-guide/glm-5.3-flashx) |
| `glm-5.3-flash` | 5.3 更轻量的版本，价格最低 | [价格](https://token.poryf.com/pricing/glm-5.3-flash) · [试用](https://token.poryf.com/model-guide/glm-5.3-flash) |
| `glm-5.2` | 上一代旗舰 | [价格](https://token.poryf.com/pricing/glm-5.2) · [试用](https://token.poryf.com/model-guide/glm-5.2) |
| `glm-5.1` | 按输入长度分档 | [价格](https://token.poryf.com/pricing/glm-5.1) · [试用](https://token.poryf.com/model-guide/glm-5.1) |
| `glm-5` | 按输入长度分档 | [价格](https://token.poryf.com/pricing/glm-5) · [试用](https://token.poryf.com/model-guide/glm-5) |
| `glm-5-turbo` | 按输入长度分档 | [价格](https://token.poryf.com/pricing/glm-5-turbo) · [试用](https://token.poryf.com/model-guide/glm-5-turbo) |
| `glm-4.7` | 按输入、输出长度分档 | [价格](https://token.poryf.com/pricing/glm-4.7) · [试用](https://token.poryf.com/model-guide/glm-4.7) |
| `glm-4.5-air` | 按输入、输出长度分档 | [价格](https://token.poryf.com/pricing/glm-4.5-air) · [试用](https://token.poryf.com/model-guide/glm-4.5-air) |

型号会随渠道调整增减，以 [模型广场](https://token.poryf.com/pricing) 和 [GET /v1/models](/api/list-models) 为准。

## 调用示例

<CodeGroup>
  ```bash curl theme={null}
  curl https://token.poryf.com/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "glm-5.3",
      "messages": [
        { "role": "user", "content": "用三句话介绍一下你自己" }
      ],
      "max_tokens": 2048
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://token.poryf.com/v1",
  )

  response = client.chat.completions.create(
      model="glm-5.3",
      messages=[{"role": "user", "content": "用三句话介绍一下你自己"}],
      max_tokens=2048,
  )
  print(response.choices[0].message.content)
  ```
</CodeGroup>

换成其他型号，只需替换 `model`。需要逐字输出时加 `"stream": true`，见 [流式输出](/streaming)。

## 计费

* 按输入、输出、缓存命中 token 分别计价。
* `glm-5.3`、`glm-5.3-flashx`、`glm-5.3-flash`、`glm-5.2` 只有一档单价。
* `glm-5.1`、`glm-5`、`glm-5-turbo` 按输入长度分档：输入低于 32K token 一档，32K 及以上一档。
* `glm-4.7`、`glm-4.5-air` 分三档：短输入短输出（输入低于 32K 且输出低于 200 token）、短输入长输出、长输入（32K 及以上）。

实时单价见 [模型广场](https://token.poryf.com/pricing)，每次调用的实际用量与扣费见 [使用日志](https://token.poryf.com/usage-logs/common)。

<Note>
  * `max_tokens` 包含思考过程。推理型号设得太小时，额度可能全部用于思考，`content` 为空。
  * 本站文本模型目前不支持在对话中识别图片。
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.