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

# ZAI GLM Chat API

> ZAI GLM chat models — GLM-4.5 (4.5/4.5-Air/4.5V), GLM-4.6 (4.6/4.6V), GLM-4.7, and GLM-5 (5/5.1/5.2) — via RouterBase, OpenAI-compatible chat completions.

## Overview

ZAI's GLM chat models on RouterBase, served through the standard
OpenAI-compatible chat completions endpoint with streaming and tool
calling. Covers the **GLM-4.5**, **GLM-4.6**, **GLM-4.7**, and **GLM-5**
families, including the vision-capable **GLM-4.5V** / **GLM-4.6V**.

|              |                                          |
| ------------ | ---------------------------------------- |
| **Provider** | ZAI                                      |
| **Families** | `glm-4.5`, `glm-4.6`, `glm-4.7`, `glm-5` |
| **Modality** | Chat                                     |
| **Input**    | Text (image on `*V` models)              |
| **Output**   | Text                                     |

## Models

* `zai/glm-5.3-flash`
* `zai/glm-5.2`
* `zai/glm-5.1`
* `zai/glm-5`
* `zai/glm-4.7`
* `zai/glm-4.6`
* `zai/glm-4.6v`
* `zai/glm-4.5`
* `zai/glm-4.5v`
* `zai/glm-4.5-air`

Pricing is deliberately not reproduced here. Rates are set per model in the
RouterBase catalogue and can be overridden per account, so any figure copied
into this page is a snapshot that goes stale the next time a rate changes.
Fetch the current rate for any model from the [Models API](/api-reference/models):

```http theme={null}
GET /api/models/{model}/pricing
```

URL-encode the slash in the model id — e.g. `zai%2Fglm-5.2`.

## Endpoint

```http theme={null}
POST https://routerbase.com/v1/chat/completions
```

Drop-in compatible with the OpenAI [Chat Completions API](https://platform.openai.com/docs/api-reference/chat) —
point your existing OpenAI client at `https://routerbase.com/v1` with
your RouterBase key. See the full [Chat Completions reference](/api-reference/chat-completions)
for every supported parameter.

## Quickstart

```bash theme={null}
curl https://routerbase.com/v1/chat/completions \
  -H "Authorization: Bearer $ROUTERBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai/glm-4.6",
    "messages": [
      { "role": "user", "content": "Explain mixture-of-experts in one sentence." }
    ]
  }'
```

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

client = OpenAI(
    base_url="https://routerbase.com/v1",
    api_key="$ROUTERBASE_API_KEY",
)

resp = client.chat.completions.create(
    model="zai/glm-5",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
```

Set `"stream": true` for token streaming (Server-Sent Events), exactly
like the OpenAI API. Swap `model` for any id from the table above.

## Vision input (GLM-4.5V / GLM-4.6V)

The `*V` models accept images alongside text using the standard OpenAI
content-parts format:

```json theme={null}
{
  "model": "zai/glm-4.6v",
  "messages": [
    { "role": "user", "content": [
      { "type": "text", "text": "What's in this image?" },
      { "type": "image_url", "image_url": { "url": "https://example.com/cat.jpg" } }
    ]}
  ]
}
```
