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.
Provider comparison
OpenRouter
z-ai/glm-5.2Unified billing, provider routing, OpenAI-compatible clients, and quick fallback testing.
Z.ai direct
glm-5.2Official platform relationship, direct support, and dedicated coding endpoint access.
HuggingFace
zai-org/GLM-5.2Open-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
You want unified billing, quick provider switching, simple model routing, and a familiar OpenAI-compatible base URL.
You want the official platform endpoint, direct account support, and access to the dedicated Coding Plan endpoint for OpenCode.