Skip to content
AI News HubLIVE
In-site rewrite2 min read

How to run GLM-5.2 in any harness

Summary

GLM-5.2 is this year's DeepSeek moment, matching closed-source quality while being 4.5x faster and 5x cheaper. This article provides step-by-step instructions to set up GLM-5.2 in Claude Code, Codex, and Deep Agents CLI in under 5 minutes.

How to run GLM-5.2 in any harness
Report an error

The correction channel is not available yet. You can copy the article reference below for later.

Correction instructions
Read article

AI engineering

How to run GLM-5.2 in any harness

Learn how to use GLM-5.2 at 280+ TPS inside Claude Code, Codex, Deep Agents CLI, or any harness.

Authors

Alex Ker

Last updated

June 24, 2026

Share

GLM-5.2 is this year’s DeepSeek moment. It’s already shifting the trajectory of how we interact with and consume intelligence.

As we and our agents continue to tokenmax, tokenonomics and performance are more relevant than ever. And GLM 5.2 is the perfect frontier model that matches closed-source models in quality while exceeding them in speed and cost by multiples (e.g., ~4.5x faster and ~5x cheaper than Opus 4.8, many are saying it's a drop-in replacement).

Open is no longer a compromise but a logical winner across dimensions for scaling yourself and your org. Here's exactly how to use GLM-5.2 inside 3 of the popular harnesses today in <5 min, which can be generalized to any other.

Claude Code

Install Claude Code: npm install -g@anthropic-ai/claude-code

Create an account at baseten.co and grab an API key from app.baseten.co/settings/api_keys

Edit ~/.claude/settings.json and add:

"env": { "ANTHROPIC_AUTH_TOKEN": "your_baseten_api_key", "ANTHROPIC_BASE_URL": "https://inference.baseten.co", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "zai-org/GLM-5.2", "ANTHROPIC_DEFAULT_SONNET_MODEL": "zai-org/GLM-5.2", "ANTHROPIC_DEFAULT_OPUS_MODEL": "zai-org/GLM-5.2" }

Run CC, and GLM-5.2 will power every Claude Code call.

Codex

Get a Baseten API key like above and store it in macOS Keychain:

security add-generic-password \ -a "$USER" \ -s codex-baseten-api-key \ -w "YOUR_BASETEN_API_KEY_HERE" \ -U

  1. Add the Baseten provider to ~/.codex/config.toml:

[model_providers.baseten] name = "Baseten" base_url = "https://inference.baseten.co/v1" wire_api = "responses"

[model_providers.baseten.auth] command = "/usr/bin/security" args = ["find-generic-password", "-a", "YOUR_MAC_USERNAME", "-s", "codex-baseten-api-key", "-w"] timeout_ms = 5000

  1. Create a profile at ~/.codex/baseten-glm.config.toml:

model = "zai-org/GLM-5.2" model_provider = "baseten" model_reasoning_effort = "medium"

Run: codex --profile baseten-glm to start Codex with GLM-5.2, and all your requests will be routed to this model.

Deep Agents CLI (LangChain)

  1. Run:

curl -LsSf https://langch.in/dcode

  1. Launch with dcode and inside it:

/install baseten → add Baseten integration

/auth → add your Baseten API key

/model → switch to GLM-5.2

A similar flow works with OpenCode, Cline, and other harnesses for a native installation experience of simply supplying the API key, so I won’t labor the setup process. I’d love to hear learnings from the token factory and what you build.

Talk to us

Connect with our product experts to see how we can help.

Talk to an engineer

Key points and analysis

Article intelligence

EngineersIntermediate

Key points

  • GLM-5.2 is a high-performance open-source model that can replace closed models like Opus 4.8
  • Configure Claude Code by editing environment variables to use GLM-5.2
  • Set up Codex with a Baseten provider and a profile configuration
  • Use Deep Agents CLI by installing the Baseten integration and switching the model

Highlights and analysis are generated automatically and may contain errors. Check the original source.