How to Use GLM-5.2 in Grok
GLM-5.2 suits codebase audits, cross-file refactoring, and engineering tasks that need sustained context. Compared with GLM-5.1, it expands the context window from 200K to 1M tokens and adds control over reasoning effort.
Prompts to try with GLM-5.2 in Grok
Copy an example into Grok, or ask in your own words.
Use GLM-5.2 to review the architecture described above. Identify coupling, failure paths, and three questions to resolve before implementation.
Use GLM-5.2 to analyze the error log pasted above. Rank likely causes and propose a test for each.
Use GLM-5.2 to compare the two API contracts above. List breaking changes and draft a migration sequence.
Use GLM-5.2 to turn the requirements above into an implementation plan with dependencies, acceptance checks, and unresolved decisions.
Use GLM-5.2 with maximum reasoning effort to challenge the optimization proposal above. Identify unsupported assumptions and design a controlled benchmark.
How to set up GLM-5.2 in Grok
Pick the way that suits you. Each takes about two minutes.
Use the Grok connector
- Add a custom connector
In Grok open Settings › Connect Apps, then Add a custom connector. Name it Spiral, paste this URL, leave Headers empty and click Add MCP.
https://api.spiral.ai/mcp
- Sign in to Spiral and approve
Grok opens Spiral: sign in, pick the organization and click Authorize. Spiral gives the connection its own API key; Grok never sees it, and you can remove the connection under Settings › Connected apps.
- Check that it is connected
Connect Apps › Custom shows Spiral as Connected. It works in every Grok chat and Grok bot.
Use the Spiral skill
- Send Grok this message
Your agent reads Spiral's skill and sets itself up.
set up https://spiral.ai/SKILL.md
- Sign in or paste a key
Approve Spiral in the browser, or give the agent a key from the console.
Use the Spiral CLI
- Install and sign in
Installs the Spiral CLI, signs you in and adds its skill to your coding agents.
npx -y spiral-cli@latest init
Call the Spiral API
- Create an API key
In the console, under API keys.
- Run GLM-5.2
One request; the result comes back by polling or a webhook.
curl https://api.spiral.ai/v1/runs \ -H "Authorization: Bearer $SPIRAL_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "provider": "openrouter", "model": "z-ai/glm-5.2", "input": { "messages": [ { "role": "system" } ] } }'
Then paste one of the prompts above: Grok finds GLM-5.2 on Spiral, shows the price and runs it.
GLM-5.2 providers and prices
Spiral runs GLM-5.2 through OpenRouter. Open a card for today's price, with every fee included.
Up to $0.012916 per run at the default inputs. $0.806 per 1M input tokens, $3.146 per 1M output tokens.
Settings you can ask for
Ask Grok for any of these in your prompt.
| Setting | Allowed values | Default | Description |
|---|---|---|---|
| Seed | a whole number | ||
| Min p | 0 to 1 | ||
| Top k | a whole number from 0 | ||
| Top p | 0 to 1 | ||
| Logprobs | on or off | ||
| Max tokens | 1 to 943718 | The most output tokens to generate. | |
| Temperature | 0 to 2 | ||
| Top logprobs | 0 to 20 | ||
| Presence penalty | -2 to 2 | ||
| Reasoning effort | none, high, or xhigh | high | How much the model reasons. |
| Frequency penalty | -2 to 2 | ||
| Repetition penalty | 0 to 2 | ||
| Parallel tool calls | on or off |
Every API field of Z.ai: GLM 5.2 is on its tool page: open its card above.
What can you do with GLM-5.2 in Grok?
Work through technical decisions and complex failures with GLM-5.2 using text supplied in the conversation. Ask for assumptions, competing explanations, and concrete checks.
Map an unfamiliar codebase
Ask GLM-5.2 to identify module responsibilities, API contracts, dependencies, and the constraints a future change must preserve.
Refactor across files
Give GLM-5.2 a bounded refactoring goal, protected behavior, and acceptance checks. Request a plan followed by implementation and verification.
Plan an API migration
Have GLM-5.2 compare existing and proposed contracts, order dependent changes, and define compatibility tests.
Investigate a complex bug
Supply GLM-5.2 with textual logs, reproduction steps, and relevant code. Request competing explanations and tests that distinguish them.
Optimize measured bottlenecks
Give GLM-5.2 profiling results and performance targets. Ask for a focused change and a repeatable before-and-after measurement.
Implement a detailed specification
Ask GLM-5.2 to turn requirements into an implementation plan, working code, and acceptance checks while tracking unresolved decisions.
More on GLM-5.2 and Grok
Overview
GLM-5.2 in other agents
More Grok guides
Questions about GLM-5.2 in Grok
Can Grok use GLM-5.2?
Yes. Add Spiral to Grok as an MCP server, and Grok can find and run GLM-5.2 like any built-in tool.
How much does GLM-5.2 cost in Grok?
Up to $0.036211 per run at the default inputs. $0.0091 per 1M input tokens, $8.84 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Grok plan is separate.
Do I need an OpenRouter account to use GLM-5.2 in Grok?
No. Spiral runs GLM-5.2 on its own OpenRouter account. You sign in to Spiral once and never paste a key.
How long does it take to set up GLM-5.2 in Grok?
About two minutes: add a custom connector, then sign in to Spiral and approve, then check that it is connected.
Does Grok wait while GLM-5.2 runs?
GLM-5.2 runs in the background. Grok starts the run, checks on it and gives you the text, json when it's ready.
What is GLM-5.2 best suited for?
Start with engineering work that spans many steps: implementing a specification, debugging a complex failure, or optimizing an existing system. Its training specifically covers sustained coding tasks.
How does GLM-5.2 differ from GLM-5.1?
GLM-5.2 increases the maximum context from 200K to 1M tokens and adds reasoning effort control. That gives you more room for project context and a way to choose how much reasoning a task receives.
Can GLM-5.2 write a million-token response?
Z.ai specifies a 1M-token context window and a separate 128K-token maximum output. Plan large deliverables in sections that fit the output limit.
Can GLM-5.2 directly analyze images or audio?
Z.ai lists text as both its input and output modality. Supply a text transcript, extracted text, or a written description when the original material uses another format.
When should I choose higher reasoning effort?
High balances reasoning depth and latency. Try Max for difficult debugging, hard math, or plans with several dependent steps, then compare the results on your actual task.
Start using GLM-5.2 in Grok
One Spiral account for every tool your agent needs. No subscription; you pay per run.
Paste this into Grok:
set up https://spiral.ai/SKILL.md


