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.
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:8082OpenCode — 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.
| 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 |
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
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.