FreeScript
GLMproxy
by eequaled · version 2026.10.17 · updated 2 days ago
No reviews yet
- Downloads
- 0
- Reviews
- 0
- Size
- 639 KB
- Code check
- Checked
- Licence
- MIT
- Released
- Nov 2026
Cross platform GLM proxy for AutoClaw's Zhipu AI models. Provides OpenAI-compatible Chat Completions and Anthropic Messages APIs for Claude Code, Cursor, Contin
GLM Proxy for AutoClaw
**GLM Proxy (
v3.3.0. One CLI, two API formats, zero npm dependencies.
Quick Start
That's it, an interactive menu walks you through format, port, and key. Prefer flags?
Then point any OpenAI-compatible tool at
You need: AutoClaw installed, running, and logged in:
Add to
Or let the proxy do it for you: run
Supported Modes & Known Caveats:
If you turn the guard off (
OpenCode
Add to your OpenCode configuration (or select auto-discovered models from
*(On Windows,
Cursor / Continue / anything OpenAI-compatible
Point it at
Or add it as a custom model directly in the UI:
JavaScript
Why this exists
AutoClaw gives you Zhipu's GLM models (GLM-5.3, GLM-5-Turbo, GLM-5.3-Flash, plus DeepSeek), but locks them inside its own desktop app. This proxy speaks OpenAI and Anthropic API dialects on one side and AutoClaw's native protocol on the other, so any tool built for those APIs can drive AutoClaw's models. The model list is pulled live from AutoClaw's runtime config, so anything AutoClaw adds or removes shows up without a proxy restart.
It also paces itself: a sliding hourly request budget per account keeps a runaway harness from burning your account into a ban. See Account safety.
-# ⚠️ A ban is not a throttle, and this proxy cannot undo one.
…
**GLM Proxy (
glmproxy)** is a local Node.js API proxy for AutoClaw's Zhipu AI GLM models. It exposes OpenAI-compatible Chat Completions and Anthropic Messages APIs, so you can use AutoClaw models with Claude Code, Cursor, Continue, OpenCode, LiteLLM, and OpenAI or Anthropic SDKs on Windows, macOS, and Linux.v3.3.0. One CLI, two API formats, zero npm dependencies.
Quick Start
npm i -g glmproxy
glmproxyThat's it, an interactive menu walks you through format, port, and key. Prefer flags?
glmproxy --anthropic --port 3001 --key mykeyThen point any OpenAI-compatible tool at
http://127.0.0.1:18791/v1, or any Anthropic-compatible tool at http://127.0.0.1:18792. Default key is mewmew (see Integrations below for exact per-tool setup).You need: AutoClaw installed, running, and logged in:
- Windows / macOS / Linux: AutoClaw 1.x reads the plaintext
request-headers.json; AutoClaw 2.x (Electron) writes an encrypted vault and the proxy decrypts it itself — Windows via DPAPI, macOS via the login Keychain, Linux via the Secret Service / GNOME Keyring. Either way auth is automatic — no manual token copying. Node.js 18+ required on all platforms. - Linux: For Linux TLS compatibility matching AutoClaw's Electron fingerprint, ensure
curl_cffiis installed (pip install curl_cffi).
Add to
~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:18792",
"ANTHROPIC_AUTH_TOKEN": "mewmew"
}
}Or let the proxy do it for you: run
glmproxy, pick Anthropic format, and choose Launch Claude Code with \. The launcher writes a settings file into the proxy's state dir, passes it through claude --settings (feature-detected — older clients fall back to environment-only routing), waits for the gateway to answer /healthz, and then hands your terminal to the interactive client. The gateway stays up when Claude Code exits; GLMP_CLAUDE_BIN points the launcher at a different binary if claude is not on PATH.Supported Modes & Known Caveats:
- Claude Agent SDK & Direct API: Fully supported. Direct
/v1/messagescalls, streaming SSE deltas, thinking blocks, and tool use execute cleanly without restrictions. - Claude Code CLI (interactive and print mode): Works. On AutoClaw 2.x the upstream's system-prompt gate rejects any prompt carrying a foreign harness signature, and Claude Code's own system prompt names itself — the proxy's identity guard (
GLMP_FOREIGN_IDENTITY_GUARD, on by default) rewrites those phrases (You are Claude Code,built on Anthropic's Claude Agent SDK, …) before forwarding. Measured 2026-10-14 against Claude Code 2.1.296 with the client's own captured system block. Print mode:
claude -p "Explain the codebase architecture"If you turn the guard off (
GLMP_FOREIGN_IDENTITY_GUARD=0), Claude Code's unmodified prompt is answered with a bare 406 on 2.x — the guard is what makes the client quote work. The system quarantine (GLMP_SYSTEM_QUARANTINE, on by default) is the safety net for this: it catches that 406, moves the harness text to user scope, and retries immediately.OpenCode
Add to your OpenCode configuration (or select auto-discovered models from
/v1/models):
{
"provider": {
"autoclaw": {
"npm": "@ai-sdk/openai-compatible",
"name": "AutoClaw",
"options": {
"baseURL": "http://localhost:18791/v1",
"apiKey": "mewmew"
},
"models": {
"zai_auto": { "name": "AutoClaw Auto" },
"zai_auto-fast": { "name": "AutoClaw Auto-Fast" },
"zaicoding_glm-5.3": { "name": "AutoClaw GLM-5.3" },
"zai_glm-5.3-flash": { "name": "AutoClaw GLM-5.3 Flash" }
}
}
}
}*(On Windows,
zai_glm-5-turbo, tdpsk_deepseek-v4-flash-202605, and tdpsk_deepseek-v4-pro-202606 are also available in the catalog).*Cursor / Continue / anything OpenAI-compatible
Point it at
http://localhost:18791/v1 with API key mewmew. Harnesses that probe for available models pick up the live list from /v1/models automatically.Or add it as a custom model directly in the UI:
- API Format: OpenAI Chat Completions
- URL:
http://localhost:18791/v1 - Model ID:
zai_auto(or any model from the table below) - API Key:
mewmew
from openai import OpenAI
client = OpenAI(base_url="http://localhost:18791/v1", api_key="mewmew")
with client.chat.completions.stream(
model="zai_auto",
messages=[{"role": "user", "content": "Hello!"}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://localhost:18791/v1",
apiKey: "mewmew",
});
const stream = await client.chat.completions.create({
model: "zai_auto",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Why this exists
AutoClaw gives you Zhipu's GLM models (GLM-5.3, GLM-5-Turbo, GLM-5.3-Flash, plus DeepSeek), but locks them inside its own desktop app. This proxy speaks OpenAI and Anthropic API dialects on one side and AutoClaw's native protocol on the other, so any tool built for those APIs can drive AutoClaw's models. The model list is pulled live from AutoClaw's runtime config, so anything AutoClaw adds or removes shows up without a proxy restart.
It also paces itself: a sliding hourly request budget per account keeps a runaway harness from burning your account into a ban. See Account safety.
-# ⚠️ A ban is not a throttle, and this proxy cannot undo one.
403 + 410004 is a real, permanent ban; 403 + 810002 "high demand" is only a capacity throttle, and the proxy retries that for…