# Zhipu AI GLM LLM Node (`llm_glm`)

Connects RocketRide pipelines to Zhipu AI's **GLM** family of open-weight
hybrid-reasoning models, served through the OpenAI-compatible Z.ai cloud API
([z.ai](https://z.ai)) or self-hosted with vLLM or SGLang.

- **Lane:** `questions → answers`
- **Endpoint (cloud, international):** `https://api.z.ai/api/paas/v4`
- **Endpoint (cloud, mainland China):** `https://open.bigmodel.cn/api/paas/v4`

## Models

The GLM-4.5 through GLM-5 generations are hybrid-reasoning MoE models with
thinking and non-thinking modes and strong agentic/coding performance. The
profile set matches the live Z.ai `/models` catalog (verified 2026-08).

| Profile | Model ID | Context | Notes |
| --- | --- | --- | --- |
| GLM-5.2 *(default)* | `glm-5.2` | 1M | Frontier long-context reasoning and coding |
| GLM-5.1 | `glm-5.1` | 200K | Previous flagship |
| GLM-5 | `glm-5` | 200K | First GLM-5 generation |
| GLM-5 Turbo | `glm-5-turbo` | 200K | Fast cost-effective tier |
| GLM-4.7 | `glm-4.7` | 200K | Enhanced-reasoning 4.x flagship |
| GLM-4.6 | `glm-4.6` | 200K | Open-weight 4.x flagship |
| GLM-4.5 | `glm-4.5` | 128K | Open-weight |
| GLM-4.5 Air | `glm-4.5-air` | 128K | Open-weight, efficient cost/quality balance |
| Custom Model | (user-defined) | (user-defined) | Any model on an OpenAI-compatible endpoint |

The vision variants (GLM-4V / GLM-4.5V), embedding, CogView (image), CogVideoX
(video), rerank, and audio lines are out of scope for this chat node.

## Reasoning output

GLM-4.5+ models are reasoning models. The Z.ai cloud returns reasoning in a
separate `reasoning_content` field, and for endpoints that inline
`<think>...</think>` blocks in `content` the engine's shared LangChain
adapter strips them and routes the reasoning to the thinking lane — the node
needs no stripping of its own. Budget generous output tokens for
reasoning-heavy prompts.

## Self-hosting

GLM weights are openly published on Hugging Face under MIT-style licenses
(`zai-org/GLM-5.2`, `zai-org/GLM-4.5-Air`, ...). To use a self-hosted vLLM or
SGLang deployment, select the **Custom Model** profile and point its server
base URL at your OpenAI-compatible endpoint; the API key may be left empty
(the node passes a dummy token — local servers accept any).

## Authentication

Cloud profiles require a Z.ai / Zhipu AI API key in `apikey`. The key
requirement is enforced by base-URL match: if `serverbase` contains `api.z.ai`
or `bigmodel.cn` and no key is set, the node raises `GLM API key is required
for cloud profiles.` at startup. Key format is not validated beyond presence.

## Model sync

Profiles are maintained by the `sync_models` tooling (`llm_glm` provider,
`ROCKETRIDE_GLM_KEY`). The include filter keeps only the `glm-*` text chat
models; vision (4V/4.5V), embedding, rerank, audio, and reward variants are
excluded (they belong in dedicated nodes).

---

<!-- ROCKETRIDE:GENERATED:PARAMS START -->
<!-- Generated by nodes:docs-generate. Do not edit by hand. -->

## Schema

| Field | Type | Description | Default |
|---|---|---|---|
| `glm.profile` | `string` | **Model**<br/>Zhipu AI GLM LLM model | `"glm-5-2"` |
| `glm.serverbase` | `string` | **Server base URL**<br/>OpenAI-compatible base URL for the GLM endpoint (e.g. https://api.z.ai/api/paas/v4 for the Z.ai cloud API, http://localhost:8000/v1 for a self-hosted vLLM / SGLang server). | `"https://api.z.ai/api/paas/v4"` |
| `model` | `string` | **Model**<br/>Zhipu AI GLM model |  |
| `modelTotalTokens` | `number` | **Tokens**<br/>Total Tokens |  |

## Dependencies

- `openai`
- `langchain-openai`
- `langchain-core`
- `langchain`

## Source

[<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true" style="vertical-align:-0.15em;margin-right:0.35em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg> View source](https://github.com/rocketride-org/rocketride-server/tree/develop/nodes/src/nodes/llm_glm)
<!-- ROCKETRIDE:GENERATED:PARAMS END -->
