Skip to content

Repository files navigation

ZChatBridge

OpenAI-compatible proxy for Z.ai GLM models. Use glm-5.2, glm-5-turbo, glm-5v-turbo, and more from any OpenAI-compatible tool.

Quick Start

pip install -r requirements.txt
python -m playwright install chromium
python get_token_real.py   # logs into Z.ai, saves token
python main.py 8082         # starts proxy on localhost:8082

Connect Your Tool

OpenCode — add to opencode.json:

"zchat": {
  "apiBase": "http://localhost:8082/v1",
  "models": {
    "glm-5.2": { "tool_use": true },
    "glm-5.1": { "tool_use": true },
    "glm-5-turbo": { "tool_use": true },
    "glm-5v-turbo": { "tool_use": true },
    "glm-4.7": { "tool_use": true }
  }
}

VS Code / Cursor / Windsurf — install Continue.dev extension, add to .continue/config.json:

{
  "models": [{
    "title": "ZChat",
    "provider": "openai",
    "model": "glm-5.2",
    "apiBase": "http://localhost:8082/v1"
  }]
}

Any OpenAI app — set apiBase to http://localhost:8082/v1.

Available Models

Model Notes
glm-5.2 Best overall
glm-5.1 Previous gen
glm-5-turbo Faster
glm-5v-turbo Vision-capable
glm-4.7 Stable fallback

Project Structure

ZChatBridge/
├── main.py                 # Proxy server
├── get_token_real.py       # Auto token capture
├── setup.bat               # One-click install
├── zchat_config.example.json
├── requirements.txt
├── SETUP.md                # Full setup guide
└── .gitignore

Security

Your Z.ai token stays on your machine. zchat_config.json (the file with your real token) is excluded from git by .gitignore. Share the repo freely — no secrets included.

About

ZChatBridge — OpenAI-compatible proxy for Z.ai's GLM models. Run glm-5.2, glm-5-turbo, glm-5v-turbo etc. from any OpenAI client (OpenCode, Continue.dev, Cursor). Uses Playwright to authenticate and bridge Z.ai's API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages