Production-quality Cursor compatibility proxy for Z.AI GLM models.
- Preserve current working functionality
- Support both
/v1/chat/completionsand/v1/responses - Always log request paths (without leaking secrets)
- Avoid environment-variable-only failures by supporting:
- CLI parameter
- interactive prompt
- env var fallback
cd tools/glm5-cursor-proxy-production
npm installnode proxy.js --api-key "YOUR_ZAI_KEY"node proxy.js --promptZAI_API_KEY="YOUR_ZAI_KEY" node proxy.jsEnable request logging when needed:
node proxy.js --debug --api-key "YOUR_ZAI_KEY"Or:
DEBUG=1 node proxy.js --api-key "YOUR_ZAI_KEY"cloudflared tunnel --url http://0.0.0.0:4001You will get a URL like:
https://<subdomain>.trycloudflare.com
Override OpenAI Base URL
https://<subdomain>.trycloudflare.com/v1
Model
GLM-5 (or GLM-5.1)
curl http://localhost:4001/healthzExpected:
{"status":"ok"}
- The proxy always uses its own API key, not the incoming request header.
- All incoming paths are logged so you can detect mismatches immediately.
- Tool result formatting is normalized for GLM compatibility.
node proxy.js --api-key "YOUR_ZAI_KEY"
cloudflared tunnel --url http://0.0.0.0:4001Then in Cursor:
Override OpenAI Base URL = https://<subdomain>.trycloudflare.com/v1
Model = GLM-5