Skip to content

Repository files navigation

ZenMux OAuth for OpenClaw

Use ZenMux models in OpenClaw with OAuth 2.0 Authorization Code + PKCE. The plugin adds browser login, automatic refresh-token rotation, model-specific protocol routing, dynamic model discovery, and an offline cache.

Install

openclaw plugins install @zenmux/openclaw-plugin
openclaw models auth login --provider zenmux

Choose ZenMux OAuth, complete authorization in the browser, then select a zenmux/... model.

How it works

  • Production uses one bundled native public OAuth client ID. Public clients do not contain a client secret.
  • Authorization uses PKCE with S256 and an ephemeral loopback callback on 127.0.0.1; after validation, the callback renders https://zenmux.ai/platform/oauth-completed?client=openclaw in a full-screen iframe.
  • Remote/VPS login accepts the full redirect URL pasted back into OpenClaw.
  • OpenClaw stores the access and refresh tokens in its own auth profile store.
  • The plugin refreshes access tokens automatically and persists rotated refresh tokens.
  • Each model uses the best protocol advertised by ZenMux: Anthropic Messages, OpenAI Responses, then Chat Completions.
  • The latest non-empty catalog is cached at ~/.cache/openclaw/zenmux/models.json. Network or empty-catalog failures preserve the last valid cache.

Only inference:invoke and offline_access are requested.

Configuration

Production requires no configuration after the public client ID is bundled. These environment variables are available for development and self-hosted deployments:

Variable Default Purpose
ZENMUX_OAUTH_ORIGIN https://zenmux.ai OAuth authorization server origin
ZENMUX_API_BASE_URL https://zenmux.ai/api/v1 OpenAI-compatible base URL
ZENMUX_ANTHROPIC_BASE_URL https://zenmux.ai/api/anthropic Anthropic-compatible base URL
ZENMUX_MODEL_CATALOG_URL https://zenmux.ai/api/frontend/model/available/list Rich model catalog URL
ZENMUX_OAUTH_CLIENT_ID bundled for production Override the native public client ID

Non-production origins dynamically register a native public client on first login and cache its client ID under the OpenClaw configuration directory.

Development

Development and the current OpenClaw host require Node 22.22.3+ in the Node 22 line, or 24.15.0+ in the Node 24 line.

npm install
npm test
npm pack --dry-run

Load the local package into an isolated OpenClaw profile with:

openclaw plugins install /absolute/path/to/openclaw-plugin

License

MIT

About

zenmux for openclaw

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages