{"_id":"@bsbofmusic/openclaw-ua-adapter","_rev":"4-764793b1497a32650a70568b6d87f84c","name":"@bsbofmusic/openclaw-ua-adapter","dist-tags":{"latest":"0.4.1"},"versions":{"0.3.1":{"name":"@bsbofmusic/openclaw-ua-adapter","version":"0.3.1","keywords":["openclaw","opencode","user-agent","compatibility","patch"],"author":{"name":"bsbofmusic"},"license":"MIT","_id":"@bsbofmusic/openclaw-ua-adapter@0.3.1","maintainers":[{"name":"bsbofmusic","email":"359633048@qq.com"}],"homepage":"https://www.npmjs.com/package/@bsbofmusic/openclaw-ua-adapter","bugs":{"url":"https://github.com/bsbofmusic/openclaw-ua-adapter/issues"},"bin":{"openclaw-ua-compat":"bin/cli.js"},"dist":{"shasum":"410eeb153443e2fd964c7c37cd1a3720bd27ff77","tarball":"https://registry.npmjs.org/@bsbofmusic/openclaw-ua-adapter/-/openclaw-ua-adapter-0.3.1.tgz","fileCount":6,"integrity":"sha512-nS8NtrLGAX2AQaSPg0a8jLNBUw9ofZgkl+uiJpxwmH/+EXvYUdOIZC2TWoWSqIygDSCcM9wfceR77yIJoIX/2A==","signatures":[{"sig":"MEUCIHzBIFFtv2asObH2pYCic1i1JuP8xky18mBEu7PzAW0YAiEAt6g6NVcOJQBRl7gOPNc2dexYw+nfvXQwfJdnmKEVTI8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39163},"type":"commonjs","engines":{"node":">=18"},"scripts":{"smoke":"node scripts/smoke.js"},"_npmUser":{"name":"bsbofmusic","email":"359633048@qq.com"},"repository":{"url":"git+https://github.com/bsbofmusic/openclaw-ua-adapter.git","type":"git"},"_npmVersion":"11.9.0","description":"A lightweight User-Agent adapter for OpenClaw providers.","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/openclaw-ua-adapter_0.3.1_1774261255082_0.6689261794318249","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@bsbofmusic/openclaw-ua-adapter","version":"0.3.2","keywords":["openclaw","opencode","user-agent","compatibility","patch"],"author":{"name":"bsbofmusic"},"license":"MIT","_id":"@bsbofmusic/openclaw-ua-adapter@0.3.2","maintainers":[{"name":"bsbofmusic","email":"359633048@qq.com"}],"homepage":"https://www.npmjs.com/package/@bsbofmusic/openclaw-ua-adapter","bugs":{"url":"https://github.com/bsbofmusic/openclaw-ua-adapter/issues"},"bin":{"openclaw-ua-adapter":"bin/cli.js"},"dist":{"shasum":"c03bfb15670567e667a5b2f4ed8062413550056b","tarball":"https://registry.npmjs.org/@bsbofmusic/openclaw-ua-adapter/-/openclaw-ua-adapter-0.3.2.tgz","fileCount":6,"integrity":"sha512-X3RmL2wdzlzU/iqKMPmjIIfGsOLImh2E30b2HFYXd2jHeClX5V6NsudqDHdEBMNPDFSJis+JL26E/1iWomELZg==","signatures":[{"sig":"MEQCICsxWPalKuZAEYBYpTG9N568j1XX8rQFbSqCttEZgi8TAiBzAuE6qQbx8+vU//TKUftBknm+cotu9onhO+oX+HmTdw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39172},"type":"commonjs","engines":{"node":">=18"},"scripts":{"smoke":"node scripts/smoke.js"},"_npmUser":{"name":"bsbofmusic","email":"359633048@qq.com"},"repository":{"url":"git+https://github.com/bsbofmusic/openclaw-ua-adapter.git","type":"git"},"_npmVersion":"11.9.0","description":"A lightweight User-Agent adapter for OpenClaw providers.","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/openclaw-ua-adapter_0.3.2_1774261624738_0.5495029257142765","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@bsbofmusic/openclaw-ua-adapter","version":"0.4.0","keywords":["openclaw","hermes","opencode","openai-compatible","proxy","user-agent","compatibility","patch"],"author":{"name":"bsbofmusic"},"license":"MIT","_id":"@bsbofmusic/openclaw-ua-adapter@0.4.0","maintainers":[{"name":"bsbofmusic","email":"359633048@qq.com"}],"homepage":"https://www.npmjs.com/package/@bsbofmusic/openclaw-ua-adapter","bugs":{"url":"https://github.com/bsbofmusic/openclaw-ua-adapter/issues"},"bin":{"openclaw-ua-adapter":"bin/cli.js"},"dist":{"shasum":"b3ded5ed84bee57d6e6ca747f8da9e463dc06a2b","tarball":"https://registry.npmjs.org/@bsbofmusic/openclaw-ua-adapter/-/openclaw-ua-adapter-0.4.0.tgz","fileCount":7,"integrity":"sha512-Hq9PAj9HDtpAmmWUDEau06n7bLSCX9J3YEleVtXBtg/yVjP2Mh4MhZ5CX+WU8dR8zeZlgnGyj/Emk6xZWe6ZQg==","signatures":[{"sig":"MEUCIDZzKMaCIAYut3wHMQilzJMO7qIC3ld7jfd5hDL3moZ5AiEAm0bmQE3woj4akY9mZs3iPAeNkJVF2lF6ewLrOopWRZA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50149},"type":"commonjs","engines":{"node":">=18"},"scripts":{"smoke":"node scripts/smoke.js"},"_npmUser":{"name":"bsbofmusic","email":"359633048@qq.com"},"repository":{"url":"git+https://github.com/bsbofmusic/openclaw-ua-adapter.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight User-Agent adapter and Hermes-friendly OpenAI-compatible proxy.","directories":{},"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/openclaw-ua-adapter_0.4.0_1777010706937_0.9253144410016505","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@bsbofmusic/openclaw-ua-adapter","version":"0.4.1","description":"A lightweight User-Agent adapter and Hermes-friendly OpenAI-compatible proxy.","bin":{"openclaw-ua-adapter":"bin/cli.js"},"type":"commonjs","author":{"name":"bsbofmusic"},"homepage":"https://www.npmjs.com/package/@bsbofmusic/openclaw-ua-adapter","keywords":["openclaw","hermes","opencode","openai-compatible","proxy","user-agent","compatibility","patch"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/bsbofmusic/openclaw-ua-adapter.git"},"bugs":{"url":"https://github.com/bsbofmusic/openclaw-ua-adapter/issues"},"scripts":{"smoke":"node scripts/smoke.js"},"engines":{"node":">=18"},"_id":"@bsbofmusic/openclaw-ua-adapter@0.4.1","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-FzDVmT4Cin2KWYLErK7FcAANvGvDE4pWtEGVtW03upV8xUv4K6FMOhmlyLr3EDdLb1bKt3aVM1JAxWNOFRTLGg==","shasum":"b3026ffcd3dc92f77190a9478952592e0976934f","tarball":"https://registry.npmjs.org/@bsbofmusic/openclaw-ua-adapter/-/openclaw-ua-adapter-0.4.1.tgz","fileCount":7,"unpackedSize":52558,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC3yd4jwPPpO3wnL3MbM/V9PdaoeZ0w+DYqxhAyvTXMWwIhALqSfdjnOac3pn91iZMPf03s1JTrfsqUyVL11Oa0xcHN"}]},"_npmUser":{"name":"bsbofmusic","email":"359633048@qq.com"},"directories":{},"maintainers":[{"name":"bsbofmusic","email":"359633048@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-ua-adapter_0.4.1_1777011495867_0.8585309180123117"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-23T10:20:54.942Z","modified":"2026-04-24T06:18:16.154Z","0.3.1":"2026-03-23T10:20:55.244Z","0.3.2":"2026-03-23T10:27:05.008Z","0.4.0":"2026-04-24T06:05:07.058Z","0.4.1":"2026-04-24T06:18:16.053Z"},"bugs":{"url":"https://github.com/bsbofmusic/openclaw-ua-adapter/issues"},"author":{"name":"bsbofmusic"},"license":"MIT","homepage":"https://www.npmjs.com/package/@bsbofmusic/openclaw-ua-adapter","keywords":["openclaw","hermes","opencode","openai-compatible","proxy","user-agent","compatibility","patch"],"repository":{"type":"git","url":"git+https://github.com/bsbofmusic/openclaw-ua-adapter.git"},"description":"A lightweight User-Agent adapter and Hermes-friendly OpenAI-compatible proxy.","maintainers":[{"name":"bsbofmusic","email":"359633048@qq.com"}],"readme":"# @bsbofmusic/openclaw-ua-adapter\n\n`@bsbofmusic/openclaw-ua-adapter` is a small helper for OpenClaw and Hermes.\n\nIt solves one practical problem: some relays only accept specific client identities. When that happens, OpenClaw or Hermes can get rejected even when the API key and model are correct. This package lets you set the provider `User-Agent` cleanly, either by updating `openclaw.json` or by running a small OpenAI-compatible proxy for Hermes.\n\nIt is meant to be:\n\n- light\n- safe\n- easy to rollback\n- friendly to existing OpenClaw installs\n\n## What it does\n\nBy default it writes this UA:\n\n```text\nopencode/1.3.0\n```\n\nIt writes it into the provider config, for example:\n\n```json\n{\n  \"models\": {\n    \"providers\": {\n      \"v2ai\": {\n        \"headers\": {\n          \"User-Agent\": \"opencode/1.3.0\"\n        }\n      }\n    }\n  }\n}\n```\n\nThat means it does not need to rewrite OpenClaw internals in the normal case.\n\n## Install\n\n```bash\nnpm i -g @bsbofmusic/openclaw-ua-adapter\n```\n\nOr run it directly:\n\n```bash\nnpx @bsbofmusic/openclaw-ua-adapter@latest apply\n```\n\n## Most useful commands\n\n```bash\nopenclaw-ua-adapter apply\nopenclaw-ua-adapter verify --base-url https://v2ai.cc/v1 --model gpt-5.4 --api-key-env OPENAI_API_KEY\nopenclaw-ua-adapter rollback\nopenclaw-ua-adapter heal --base-url https://v2ai.cc/v1 --model gpt-5.4 --api-key-env OPENAI_API_KEY\n```\n\n## Hermes proxy mode\n\nUse `serve` when the client cannot inject the required upstream `User-Agent` or when you want Hermes to use a local adapter key while the adapter owns the real upstream key.\n\n```bash\nOPENCLAW_UA_ADAPTER_UPSTREAM_BASE_URL=https://api.example.com/v1 \\\nOPENCLAW_UA_ADAPTER_UPSTREAM_API_KEY=sk-your-upstream-key \\\nOPENCLAW_UA_ADAPTER_USER_AGENT=opencode/1.3.0 \\\nOPENCLAW_UA_ADAPTER_MODELS=gpt-5.5,gpt-5.4 \\\nnpx @bsbofmusic/openclaw-ua-adapter@latest serve\n```\n\nThen point Hermes at the local adapter:\n\n```yaml\nmodel:\n  provider: custom\n  default: gpt-5.5\n  base_url: http://openclaw-ua-adapter:8787/v1\n  api_key: adapter-local-key\n  api_mode: chat_completions\n```\n\nThe adapter accepts Hermes requests at:\n\n```text\nGET  /health\nGET  /v1/models\nPOST /v1/chat/completions\nPOST /v1/responses\n```\n\nStreaming responses are passed through chunk-by-chunk. The adapter must not buffer SSE output because Hermes and Discord clients expect partial tokens quickly.\n\nIt forwards to the upstream paths without duplicating `/v1`, so `/v1/chat/completions` becomes `<upstream>/chat/completions` when the upstream base URL already ends in `/v1`.\n\n### Docker Compose Example\n\n```yaml\nservices:\n  openclaw-ua-adapter:\n    image: node:22-alpine\n    command: sh -lc \"npx -y @bsbofmusic/openclaw-ua-adapter@latest serve\"\n    environment:\n      OPENCLAW_UA_ADAPTER_UPSTREAM_BASE_URL: https://api.example.com/v1\n      OPENCLAW_UA_ADAPTER_UPSTREAM_API_KEY: ${UPSTREAM_API_KEY}\n      OPENCLAW_UA_ADAPTER_USER_AGENT: opencode/1.3.0\n      OPENCLAW_UA_ADAPTER_MODELS: gpt-5.5,gpt-5.4\n    restart: unless-stopped\n```\n\nFor compatibility with earlier one-off deployments, these legacy env names also work: `UPSTREAM_BASE_URL`, `UPSTREAM_API_KEY`, `UPSTREAM_USER_AGENT`, `UPSTREAM_EXTRA_HEADERS`, and `UPSTREAM_MODELS`.\n\n## Recommended VPS usage\n\nIf your machine has more than one OpenClaw home, pass the real gateway config path explicitly:\n\n```bash\nopenclaw-ua-adapter apply \\\n  --config-path /var/lib/openclaw/.openclaw/openclaw.json \\\n  --provider v2ai \\\n  --ua opencode/1.3.0\n```\n\nThis is usually safer than relying on auto-detect.\n\n## Extra headers\n\nIf your relay also needs extra headers, you can add them:\n\n```bash\nopenclaw-ua-adapter apply \\\n  --header \"X-Client-Name=opencode\"\n```\n\nOr use JSON:\n\n```bash\nopenclaw-ua-adapter apply --headers-json '{\"X-Client-Name\":\"opencode\"}'\n```\n\n## Runtime fallback mode\n\nNormally this package only edits `openclaw.json`.\n\nIf that is not enough, it also has a runtime fallback mode that patches the bundled OpenAI client directly:\n\n```bash\nopenclaw-ua-adapter apply-runtime --target /opt/openclaw-runtime/node/lib/node_modules/openclaw/node_modules/openai/client.js\n```\n\nUse that only when the config route is not enough.\n\n## Safety\n\n- Creates a backup before writing config\n- Restarts `openclaw` by default on Linux\n- Supports `rollback`\n- Supports `heal` to try candidate UAs\n- Does not write custom root-level config keys\n\n## Release\n\n```bash\nnpm run smoke\nnpm pack\nnpm publish --access public\n```\n","readmeFilename":"README.md"}