Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GLM Cursor Proxy (Production)

Production-quality Cursor compatibility proxy for Z.AI GLM models.

Goals

  • Preserve current working functionality
  • Support both /v1/chat/completions and /v1/responses
  • Always log request paths (without leaking secrets)
  • Avoid environment-variable-only failures by supporting:
    • CLI parameter
    • interactive prompt
    • env var fallback

Install

cd tools/glm5-cursor-proxy-production
npm install

Run (recommended ways)

1) CLI parameter (most reliable)

node proxy.js --api-key "YOUR_ZAI_KEY"

2) Interactive prompt (no env required)

node proxy.js --prompt

3) Environment variable

ZAI_API_KEY="YOUR_ZAI_KEY" node proxy.js

Debug logging (off by default)

Enable request logging when needed:

node proxy.js --debug --api-key "YOUR_ZAI_KEY"

Or:

DEBUG=1 node proxy.js --api-key "YOUR_ZAI_KEY"

Cloudflare tunnel

cloudflared tunnel --url http://0.0.0.0:4001

You will get a URL like:

https://<subdomain>.trycloudflare.com

Cursor configuration

Override OpenAI Base URL

https://<subdomain>.trycloudflare.com/v1

Model

GLM-5 (or GLM-5.1)

Health check

curl http://localhost:4001/healthz

Expected:

{"status":"ok"}

Notes

  • 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.

Example commands

node proxy.js --api-key "YOUR_ZAI_KEY"
cloudflared tunnel --url http://0.0.0.0:4001

Then in Cursor:

Override OpenAI Base URL = https://<subdomain>.trycloudflare.com/v1
Model = GLM-5

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages