[Integrations](https://spiral.ai/integrations) › [Gemini CLI](https://spiral.ai/integrations/gemini-cli) › [GLM-5.2](https://spiral.ai/integrations/gemini-cli/glm-5-2)

# How to Use GLM-5.2 in Gemini CLI

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.

|  |  |
| --- | --- |
| Model | GLM-5.2 |
| Available through | OpenRouter |
| Category | LLM |
| Price | Up to $0.036211 per run at the default inputs. $0.0091 per 1M input tokens, $8.84 per 1M output tokens. |
| Returns | text, json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with GLM-5.2 in Gemini CLI

- Use GLM-5.2 to audit this repository. Map modules, API contracts, and data flows; cite file paths for each finding.
- Use GLM-5.2 to separate this repository's billing logic from request handling. Preserve public behavior, plan the changes, then run relevant tests.
- Use GLM-5.2 to investigate the failing integration test. Reproduce it, test competing causes, and verify the smallest justified fix.
- Use GLM-5.2 to migrate this project's deprecated API calls. Inventory callers, preserve compatibility, and report validation results.
- Use GLM-5.2 to investigate this project's slowest endpoint. Establish a baseline, change the measured bottleneck, and rerun the benchmark.

## How to set up GLM-5.2 in Gemini CLI

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: Or add it to `~/.gemini/settings.json` yourself:

```bash
gemini mcp add --scope user --transport http spiral https://api.spiral.ai/mcp
```

2. **Sign in**: Start `gemini` and run:

```text
/mcp auth spiral
```

3. **Check it**: In Gemini CLI, run `/mcp`. From your shell:

```bash
gemini mcp list
```

### Use the Spiral skill

1. **Send Gemini CLI this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run GLM-5.2**: One request; the result comes back by polling or a webhook.

```bash
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: Gemini CLI finds GLM-5.2 on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/gemini-cli

## GLM-5.2 tools and prices

- [Z.ai: GLM 5.2](https://spiral.ai/tools/openrouter/z-ai/glm-5.2) (OpenRouter): 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

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| seed |  | — |  |
| stop |  | — |  |
| min_p | 0 to 1 | — |  |
| tools |  | — |  |
| top_k | 0 to … | — |  |
| top_p | 0 to 1 | — |  |

## What can you do with GLM-5.2 in Gemini CLI?

Turn project context into coordinated code changes with GLM-5.2. Give the agent a bounded goal, repository conventions, and explicit verification requirements.

### 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.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All Gemini CLI guides](https://spiral.ai/integrations/gemini-cli)

## GLM-5.2 in other agents

- [Amp](https://spiral.ai/integrations/amp/glm-5-2)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/glm-5-2)
- [Claude](https://spiral.ai/integrations/claude-desktop/glm-5-2)
- [Claude Code](https://spiral.ai/integrations/claude-code/glm-5-2)
- [Cline](https://spiral.ai/integrations/cline/glm-5-2)
- [Codex](https://spiral.ai/integrations/codex/glm-5-2)
- [Cursor](https://spiral.ai/integrations/cursor/glm-5-2)
- [Devin](https://spiral.ai/integrations/devin/glm-5-2)
- [dots](https://spiral.ai/integrations/dots/glm-5-2)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/glm-5-2)
- [Gemini](https://spiral.ai/integrations/gemini/glm-5-2)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/glm-5-2)
- [goose](https://spiral.ai/integrations/goose/glm-5-2)
- [Grok](https://spiral.ai/integrations/grok/glm-5-2)
- [Grok Build](https://spiral.ai/integrations/grok-build/glm-5-2)
- [Hermes](https://spiral.ai/integrations/hermes/glm-5-2)
- [Instinct](https://spiral.ai/integrations/instinct/glm-5-2)
- [Manus](https://spiral.ai/integrations/manus/glm-5-2)
- [Muse](https://spiral.ai/integrations/muse/glm-5-2)
- [Muse Code](https://spiral.ai/integrations/muse-code/glm-5-2)
- [n8n](https://spiral.ai/integrations/n8n/glm-5-2)
- [Notion](https://spiral.ai/integrations/notion/glm-5-2)
- [OpenClaw](https://spiral.ai/integrations/openclaw/glm-5-2)
- [opencode](https://spiral.ai/integrations/opencode/glm-5-2)
- [Perplexity](https://spiral.ai/integrations/perplexity/glm-5-2)
- [Raycast](https://spiral.ai/integrations/raycast/glm-5-2)
- [VS Code](https://spiral.ai/integrations/vscode/glm-5-2)
- [Windsurf](https://spiral.ai/integrations/windsurf/glm-5-2)
- [Zapier](https://spiral.ai/integrations/zapier/glm-5-2)

## More Gemini CLI guides

- [GLM-5 Turbo](https://spiral.ai/integrations/gemini-cli/glm-5-turbo)
- [GLM-5.3](https://spiral.ai/integrations/gemini-cli/glm-5-3)
- [GLM-5](https://spiral.ai/integrations/gemini-cli/glm-5)
- [GLM-5V-Turbo](https://spiral.ai/integrations/gemini-cli/glm-5v-turbo)
- [GLM-4.7](https://spiral.ai/integrations/gemini-cli/glm-4-7)
- [GPT Astra](https://spiral.ai/integrations/gemini-cli/gpt-astra)

## Questions about GLM-5.2 in Gemini CLI

**Can Gemini CLI use GLM-5.2?**

Yes. Add Spiral to Gemini CLI as an MCP server, and Gemini CLI can find and run GLM-5.2 like any built-in tool.

**How much does GLM-5.2 cost in Gemini CLI?**

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 Gemini CLI plan is separate.

**Do I need an OpenRouter account to use GLM-5.2 in Gemini CLI?**

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 Gemini CLI?**

About two minutes: add the server, then sign in, then check it.

**Does Gemini CLI wait while GLM-5.2 runs?**

GLM-5.2 runs in the background. Gemini CLI 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.

