[Integrations](https://spiral.ai/integrations) › [Codex](https://spiral.ai/integrations/codex) › [GLM-4.5](https://spiral.ai/integrations/codex/glm-4-5)

# How to Use GLM-4.5 in Codex

GLM-4.5 suits code fixes, complex reasoning, and tasks that require tools. Compared with GLM-4.5-Air, it uses a larger model; it offers thinking for harder tasks and direct responses for simpler requests.

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

## Prompts to try with GLM-4.5 in Codex

- Use GLM-4.5 with thinking enabled to reproduce the failing test in this project, trace the cause, and make the smallest fix. Run the relevant tests and explain what they establish.
- Use GLM-4.5 to build the account settings page described in the project specification. Follow existing components, implement save and error states, and verify each acceptance criterion.
- Use GLM-4.5 with thinking enabled to review the authentication code for inconsistent session handling. Cite the relevant files, describe a reproducible failure, and propose a focused correction.
- Use GLM-4.5 to refactor the duplicated validation logic in this project. First identify existing behavior and constraints, then implement the change and check that public behavior stays consistent.
- Use GLM-4.5 to compare the API specification with its implementation. Return JSON listing each mismatch, its location, expected behavior, and evidence; use an empty list if none are found.

## How to set up GLM-4.5 in Codex

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

### Use Spiral's MCP server

1. **Add the hosted server**

```bash
codex mcp add spiral --url https://api.spiral.ai/mcp
```

2. **Sign in**: Codex opens the browser: sign in to Spiral and click Authorize. No API key. `codex mcp list` then shows Spiral.

```bash
codex mcp login spiral
```

### Use the Spiral skill

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

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

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

## GLM-4.5 tools and prices

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

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| tools |  | — |  |
| top_k | 0 to … | — |  |
| top_p | 0 to 1 | — |  |
| reasoning |  | — | Reasoning effort; reasoning tokens count toward max_tokens. |
| max_tokens | 1 to 98304 | — | The most output tokens to generate. |
| temperature | 0 to 2 | — |  |

## What can you do with GLM-4.5 in Codex?

Turn a bug report or feature request into a code change with verification using GLM-4.5. Supply project context and acceptance criteria so the agent can plan, edit, and check its work.

### Fix a reproducible bug

Give GLM-4.5 the failing behavior, relevant code, and expected result. Ask for a focused fix and a regression check.

### Build a working web prototype

Ask GLM-4.5 to turn a written specification into a web prototype with explicit user interactions and acceptance criteria.

### Compare plans with competing constraints

Give GLM-4.5 the requirements and available choices. Request a comparison that identifies conflicts, assumptions, and unresolved questions.

### Research a question across sources

Use GLM-4.5 with an agent's search tools to gather evidence, compare claims, and draft an answer with source links.

### Extract structured records

Ask GLM-4.5 to turn supplied text into JSON using an explicit structure, required values, and a rule for missing information.

### Draft a presentation

Give GLM-4.5 an audience, source material, and slide count. Request slide titles, supporting points, and speaker notes.

### Review a long specification

Ask GLM-4.5 to identify conflicting requirements and unanswered questions in supplied text, citing the relevant sections.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All Codex guides](https://spiral.ai/integrations/codex)

## GLM-4.5 in other agents

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

## More Codex guides

- [GLM Latest](https://spiral.ai/integrations/codex/glm-latest)
- [GLM-4.5V](https://spiral.ai/integrations/codex/glm-4-5v)
- [GLM Flash Latest](https://spiral.ai/integrations/codex/glm-flash-latest)
- [GLM-4.6](https://spiral.ai/integrations/codex/glm-4-6)
- [GLM 5.3 Prime](https://spiral.ai/integrations/codex/glm-5-3-prime)
- [GLM-4.6V](https://spiral.ai/integrations/codex/glm-4-6v)

## Questions about GLM-4.5 in Codex

**Can Codex use GLM-4.5?**

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

**How much does GLM-4.5 cost in Codex?**

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

**Do I need an OpenRouter account to use GLM-4.5 in Codex?**

No. Spiral runs GLM-4.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-4.5 in Codex?**

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

**Does Codex wait while GLM-4.5 runs?**

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

**What is GLM-4.5 useful for?**

Use GLM-4.5 for code changes, complex reasoning, and tasks that combine analysis with tools. It also suits drafting presentation content and producing structured text.

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

Z.ai documents a 128K context window and up to 96K output tokens. Treat these as limits, and request a specific answer length for the task.

**When should I use thinking mode?**

Choose thinking for debugging, complex reasoning, and decisions involving tools. Use direct responses for straightforward requests such as rewriting a paragraph.

**Where does GLM-4.5 fall short?**

Code generation still needs verification. In Z.ai's CC-Bench comparison with Claude Sonnet 4, GLM-4.5 won 40.4%, tied 9.6%, and lost 50% of comparisons; ask for checks that demonstrate the requested behavior.

**Can GLM-4.5 work in English and Chinese?**

Yes. Z.ai's evaluation included English, Chinese, and other-language prompts; it does not establish equal performance across every language or task.

