GLM52.pro

Run GLM 5.2 Locally

Use zai-org/GLM-5.2 with vLLM, SGLang, Transformers, KTransformers, or Unsloth.

Supported Local Paths

vLLM
OpenAI-compatible API serving
Production and private API deployments
SGLang
High-throughput inference server
Agentic coding and batch workloads
Transformers
Python research workflow
Scripts, notebooks, and experimentation
KTransformers
Optimized local inference
Workstation experiments
Unsloth
Fine-tuning workflow
Adapter training and evaluation

Step-by-Step Setup

1

Get the model

Use the official HuggingFace repository for the current open weights.

huggingface-cli download zai-org/GLM-5.2 --local-dir ./GLM-5.2
2

Serve with vLLM

vLLM is one of the supported local serving frameworks for GLM 5.2.

pip install vllm
vllm serve zai-org/GLM-5.2 --served-model-name glm-5.2
3

Serve with SGLang

SGLang is also listed as a supported GLM 5.2 deployment path.

pip install sglang
python -m sglang.launch_server --model-path zai-org/GLM-5.2 --served-model-name glm-5.2
4

Call the local server

Most serving frameworks expose an OpenAI-compatible chat completions API.

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
  "model": "glm-5.2",
  "messages": [{"role": "user", "content": "Write a Python hello world"}]
}'

Use a Local Server with OpenCode

Once your local OpenAI-compatible server is running, point OpenCode at it:

# In your OpenCode config (opencode.json)
{
  "model": {
    "provider": "openai",
    "name": "glm-5.2",
    "baseURL": "http://localhost:8000/v1",
    "apiKey": "local"
  }
}

Tips for Best Performance

  • Use vLLM or SGLang for API serving rather than old GLM4 Ollama examples.
  • Plan capacity around the 1M-token context. Full-context runs need much more memory.
  • Use the official HuggingFace repository: zai-org/GLM-5.2.
  • For production, compare local serving cost against Z.ai or OpenRouter before committing.