GLM-5.2 is a lower-cost pick for coding agents that need to stay on track across a long job. Z.ai released it in June 2026 as an open-weight mixture-of-experts model with roughly 753 billion parameters. Its docs describe a work style that suits multi-file projects: break the goal down, spot dependencies and risks, then build and verify step by step.
Z.ai says the model stays stable across its full 1M-token context during long tasks.
What you can use it for
- Software changes that span a whole project, not one file
- Agent jobs where a written plan should come before any action
- Long documents where other models lose the thread halfway
- A cheaper engine for coding agents that burn through tokens
- Teams that prefer open weights for future self-hosting
Settings and limits
- Context window: 1,000,000 tokens; output up to 131,072 tokens.
- Z.ai reworked the attention design to lower compute per token at 1M context, but every token you send is still billed.
- Pass only the files the task needs instead of the whole repository.
- Ask for the plan explicitly in the prompt so you can review it before the model starts editing.
Example request
from openai import OpenAI
client = OpenAI(
base_url="https://kadraris.com/v1",
api_key="sk-kd-...",
)
resp = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user",
"content": "Plan, then implement, a CSV "
"export across these 4 files."}],
)
print(resp.choices[0].message.content)Paste the relevant files after the instruction and name the ones that must not change.
Questions
How much does GLM-5.2 cost?
$1.22 / $4.05 per 1M tokens on Kadraris, well under the flagship closed models. That gap adds up on long agent runs where token counts climb fast. A failed call costs $0.
Should I use GLM 5.3 instead?
glm-5.3 is Z.ai's newer flagship with a larger context and much longer outputs. Keep GLM-5.2 if your prompts already work well on it, and compare both on one real task before switching.
GLM-5.2 in your code
from openai import OpenAI
client = OpenAI(base_url="https://kadraris.com/v1", api_key="sk-kd-...")
resp = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Suggest three opening shots for a short film about a cafe."}],
)
print(resp.choices[0].message.content)curl https://kadraris.com/v1/chat/completions \
-H "Authorization: Bearer $KADRARIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "glm-5.2", "messages": [{"role": "user", "content": "Suggest three opening shots for a short film about a cafe."}]}'import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://kadraris.com/v1", apiKey: process.env.KADRARIS_API_KEY });
const resp = await client.chat.completions.create({
model: "glm-5.2",
messages: [{ role: "user", content: "Suggest three opening shots for a short film about a cafe." }],
});
console.log(resp.choices[0].message.content);
























