GLM52.pro

GLM 5.2 on OpenRouter

OpenRouter exposes GLM 5.2 through the OpenAI-compatible API using the model ID z-ai/glm-5.2. It is a good fit for apps that already route multiple LLM providers through one endpoint and want a simple way to test GLM 5.2 beside other coding and reasoning models.

Model ID
z-ai/glm-5.2
Base URL
https://openrouter.ai/api/v1
Context
1M-token context
Input price
$1.20 / 1M tokens
Output price
$4.10 / 1M tokens
Good for
reasoning and coding

Provider comparison

OpenRouter

z-ai/glm-5.2

Unified billing, provider routing, OpenAI-compatible clients, and quick fallback testing.

Z.ai direct

glm-5.2

Official platform relationship, direct support, and dedicated coding endpoint access.

HuggingFace

zai-org/GLM-5.2

Open-weight research, local deployment experiments, and self-hosted evaluation.

OpenAI-compatible request

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "z-ai/glm-5.2",
    "messages": [
      {"role": "user", "content": "Reason through this bug and propose a patch."}
    ],
    "reasoning": { "enabled": true }
  }'

Node.js fetch example

const result = await fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
    "Content-Type": "application/json",
    "HTTP-Referer": "https://glm52.pro",
    "X-Title": "GLM52.pro",
  },
  body: JSON.stringify({
    model: "z-ai/glm-5.2",
    messages: [{ role: "user", content: "Write a migration checklist." }],
    reasoning: { enabled: true },
  }),
});

console.log(await result.json());

OpenRouter vs Direct Z.ai

Choose OpenRouter when

You want unified billing, quick provider switching, simple model routing, and a familiar OpenAI-compatible base URL.

Choose Z.ai direct when

You want the official platform endpoint, direct account support, and access to the dedicated Coding Plan endpoint for OpenCode.

Compare with the GLM5.2 API guide