[Integrations](https://spiral.ai/integrations) › [VS Code](https://spiral.ai/integrations/vscode) › [GLM-5](https://spiral.ai/integrations/vscode/glm-5)

# How to Use GLM-5 in VS Code

GLM-5 is built for complex software engineering, including backend architecture, debugging, and tasks with several stages. Compared with GLM-5 Turbo's focus on persistent tool workflows, GLM-5 targets broader systems engineering.

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

## Prompts to try with GLM-5 in VS Code

- Use GLM-5 with thinking enabled to investigate the failing tests in this project. Reproduce the failure, identify the cause, make the smallest useful patch, and report which checks passed.
- Use GLM-5 to review this project's backend architecture before we add organization accounts. Map the affected components, identify migration risks, and propose steps with acceptance criteria.
- Use GLM-5 with temperature 0.7 and top-p 0.95 to investigate duplicate records in this project. Trace the write path, reproduce the problem, and verify a focused fix.
- Ask GLM-5 through Spiral to review the diff on this branch and list the three riskiest changes. Save the result in ./assets.
- Get a second opinion from GLM-5 on this function, then tell me what the call cost.

## How to set up GLM-5 in VS Code

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

### Use Spiral's MCP server

1. **Add the hosted server**: Use Add to VS Code on the console's Agents & MCP page, or run:

```bash
code --add-mcp '{"name":"spiral","type":"http","url":"https://api.spiral.ai/mcp"}'
```

2. **Sign in**: VS Code asks you to sign in when it first starts the server: sign in to Spiral and click Authorize. No API key. Run MCP: List Servers from the Command Palette to check that Spiral is running.

### Use the Spiral skill

1. **Send VS Code 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**: 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",
    "input": {
      "messages": [
        {
          "role": "system"
        }
      ]
    }
  }'
```

Then paste one of the prompts above: VS Code finds GLM-5 on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/vscode

## GLM-5 tools and prices

- [Z.ai: GLM 5](https://spiral.ai/tools/openrouter/z-ai/glm-5) (OpenRouter): Up to $0.017086 per run at the default inputs. $1.30 per 1M input tokens, $4.16 per 1M output tokens.

## Settings you can ask for

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

## What can you do with GLM-5 in VS Code?

Turn a project requirement or bug report into code changes with checks that demonstrate the result. GLM-5 can help trace dependencies and plan work across several files.

### Reproduce and fix a backend bug

Give the agent a failing request, relevant logs, and expected behavior. Ask it to trace the cause, make a focused patch, and demonstrate the fix.

### Plan a backend refactor

Map dependencies, identify behavior that must stay consistent, and divide the change into reviewable steps with acceptance checks.

### Implement a feature from requirements

Turn a feature brief into an implementation plan, code changes, and a record of completed checks. State the expected user behavior before work begins.

### Research a technical decision

Have the agent retrieve documentation, compare options against stated requirements, and produce a recommendation with supporting links and unresolved questions.

### Extract records from text

Turn pasted notices, support requests, or meeting notes into consistently structured records. Define the expected structure and a rule for missing information.

### Prepare a recurring operations brief

Combine recent tool results into a short report covering changes, unresolved problems, and next actions. Carry a compact summary between runs.

### Investigate a data discrepancy

Ask the agent to compare reported totals, inspect relevant records through available tools, and explain which checks support its conclusion.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All VS Code guides](https://spiral.ai/integrations/vscode)

## GLM-5 in other agents

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

## More VS Code guides

- [GLM-4.7](https://spiral.ai/integrations/vscode/glm-4-7)
- [GLM-5 Turbo](https://spiral.ai/integrations/vscode/glm-5-turbo)
- [GLM-4.6V](https://spiral.ai/integrations/vscode/glm-4-6v)
- [GLM-5.2](https://spiral.ai/integrations/vscode/glm-5-2)
- [GLM-4.6](https://spiral.ai/integrations/vscode/glm-4-6)
- [GLM-5.3](https://spiral.ai/integrations/vscode/glm-5-3)

## Questions about GLM-5 in VS Code

**Can VS Code use GLM-5?**

Yes. Add Spiral to VS Code as an MCP server, and VS Code can find and run GLM-5 like any built-in tool.

**How much does GLM-5 cost in VS Code?**

Up to $0.017086 per run at the default inputs. $1.30 per 1M input tokens, $4.16 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your VS Code plan is separate.

**Do I need an OpenRouter account to use GLM-5 in VS Code?**

No. Spiral runs GLM-5 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 in VS Code?**

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

**Does VS Code wait while GLM-5 runs?**

GLM-5 runs in the background. VS Code starts the run, checks on it and gives you the text, json when it's ready.

**What is GLM-5 best suited for?**

Use GLM-5 for software engineering and tasks that require planning, tool use, and several rounds of checking. GLM-5 emphasizes complex systems work; GLM-5 Turbo emphasizes persistent workflows with many actions.

**How much text can GLM-5 handle?**

Z.ai lists a 200K context window and a maximum output of 128K tokens for both GLM-5 and GLM-5 Turbo. Those figures describe capacity, so choose an answer length that fits the task.

**When should I enable thinking?**

Enable thinking for debugging, complex planning, and decisions with several constraints. Ask for a concise conclusion and verification evidence so the final answer stays useful.

**How do I get useful JSON responses?**

Specify the exact structure, required information, and how to handle missing values. Include a small example so the requested result is unambiguous.

**How should I handle long research conversations?**

Keep the current question, constraints, and relevant evidence in a compact working summary. The GLM-5 technical report found that accuracy can decline in extremely long contexts, so avoid carrying every old tool result forward.

