@xsquads/zap
v2.1.1
Published
Run Claude Code against open-source models, metered by credits.
Readme
zap
Run Claude Code (and Codex) with open-source models like GLM 5.2, Kimi K2, QWen etc., metered by credits.
Install
npm install -g @xsquads/zapRequires Node >= 20. zap does not bundle or run a local router — the zap
worker speaks the Anthropic and OpenAI wire formats natively, so zap claude
just sets environment variables and spawns claude, and zap codex points
the Codex CLI at the worker via -c overrides. The CLIs themselves are
external prerequisites installed from PATH:
npm install -g @anthropic-ai/claude-code # for `zap claude`
npm install -g @openai/codex # for `zap codex`Optional: compress prompts with headroom
If the headroom proxy is installed, zap
claude and zap codex automatically route through it on 127.0.0.1 to
compress prompts and tool outputs before they reach the zap worker — fewer
tokens, less energy, lower credit burn:
pip install "headroom-ai[proxy]" # or: uv tool install "headroom-ai[proxy]"Nothing else to configure — zap starts and stops the proxy per session and
falls back to a direct connection if headroom is missing or fails to start.
Set ZAP_HEADROOM=0 to disable it.
Staying up to date
zap checks npm for a newer version at most once a day (2 s budget, cached in
~/.zap/update-check.json). When one exists it asks Update now? [y/N] — a
yes runs npm install -g @xsquads/zap@latest; in non-interactive shells it
just prints a one-line notice. Set ZAP_UPDATE_CHECK=0 (or run in CI) to
disable the check entirely. It never installs anything without an explicit yes.
Login
zap loginOpens Google OAuth in your browser.
If the browser doesn't open, the command prints the URL — copy it manually.
Run Claude Code
zap claudeInside Claude Code, open the /model picker to see every zap model and switch
at runtime (requires Claude Code v2.1.129+). zap claude enables gateway model
discovery, so the worker's models populate the picker; selecting one routes
subsequent requests through it. You can also switch with /model <id> (e.g.
/model glm-5.2) on any version.
zap claude -- --model glm-5.2 "explain this file"Run Codex
zap codexzap codex -- "explain this file"The exit code of codex is propagated.
Commands
zap whoami # email + balance in USD
zap credits # balance + recent ledger activity
zap logout # revoke session + clear local token
zap -v # display the current version of the package