Skip to content

Commit 97a2cf6

Browse files
TheStreamCodeMichael Gasperini
andauthored
docs: bring README to the repository standard, cap dependabot PRs (#18)
Add the missing Features section, fold the wire-compatibility deep dive into ADAPTER_CONTRACT.md plus the sections that already cover it, trim 1835 to 1197 words, use the canonical footer. Add open-pull-requests-limit 5 to both dependabot updates. Co-authored-by: Michael Gasperini <michael@mikesoft.it>
1 parent 64a69f5 commit 97a2cf6

2 files changed

Lines changed: 70 additions & 113 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ updates:
77
day: "monday"
88
labels:
99
- "dependencies"
10+
open-pull-requests-limit: 5
1011
groups:
1112
npm-minor-patch:
1213
update-types:
@@ -23,6 +24,7 @@ updates:
2324
commit-message:
2425
prefix: "chore(actions)"
2526
include: "scope"
27+
open-pull-requests-limit: 5
2628
groups:
2729
actions-minor-patch:
2830
update-types:

‎README.md‎

Lines changed: 68 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,16 @@ Muse models in OpenClaw billed to the Muse Code subscription
66
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
77
[![ClawHub](https://img.shields.io/badge/ClawHub-%40thestreamcode%2Fopenclaw--muse--code-blue)](https://clawhub.ai/plugins/@thestreamcode/openclaw-muse-code)
88

9-
Provider plugin for [OpenClaw](https://openclaw.ai) with a Muse Code device login. No API key to
10-
copy and no third-party CLI to install. A successful login does not guarantee model access: Meta
11-
may reject subscription requests from clients other than Muse Code.
9+
Provider plugin for [OpenClaw](https://openclaw.ai): Muse Code device login, no API key, no
10+
third-party CLI.
1211

1312
> **Unofficial and experimental.** This plugin uses a Muse Code subscription credential from
1413
> OpenClaw. Meta's terms limit that credential to Muse Code, so this use may not be supported and
1514
> Meta may suspend or revoke accounts or credentials. Use it at your own risk; the authors cannot
1615
> recover an account. Read [DISCLAIMER.md](DISCLAIMER.md) before installing.
1716
18-
The official [`@openclaw/meta-provider`](https://clawhub.ai) plugin serves the same models over
19-
the same Meta Model API but bills per-token API credits through `MODEL_API_KEY`. This plugin uses
20-
the same wire (`https://api.meta.ai/v1`, Responses API) with a subscription credential.
21-
Provider id `muse-code` is intentionally distinct from the official `meta` id, so both plugins
22-
can be installed side by side.
23-
24-
## Meta Responses wire compatibility
25-
26-
Since 2026-10-29, `https://api.meta.ai/v1` refuses a Muse Code subscription credential when the
27-
request declares a flat function tool whose name exactly matches one of Muse Code's builtin tool
28-
names (the full pinned set is in [ADAPTER_CONTRACT.md](ADAPTER_CONTRACT.md)). The refusal is HTTP
29-
403 with `code: client_attestation_denied`; names that do not collide are accepted.
30-
31-
The plugin therefore starts a loopback adapter on `127.0.0.1` (first free port of 43219-43222,
32-
then an ephemeral port) and publishes its `/v1` origin as the provider base URL. The adapter
33-
aliases exactly the colliding tool names on the way out, restores them in the response, and
34-
normalizes the few Responses fields Meta validates (`tool_choice`, reasoning effort, the
35-
output-token floor, the encrypted-reasoning include). Every other path, including model
36-
discovery, is relayed untouched. The wire rules are pinned in
37-
[ADAPTER_CONTRACT.md](ADAPTER_CONTRACT.md); they are a compatibility layer for the Meta Responses
38-
wire format, and Meta's policy still applies. If Meta still refuses the request, the adapter
39-
retries once with every tool aliased.
40-
41-
The adapter is unref'd, so one-shot CLI commands that load the plugin can exit, and its output
42-
floor is 1024 tokens for OpenClaw: the connection probe asks for a tiny budget that a reasoning
43-
turn would otherwise consume before producing text. `reasoning.effort` values `none` and `off`
44-
map to `minimal`, which is the lowest effort Meta accepts. The static manifest catalog carries
45-
display metadata only and deliberately omits a base URL, so the host resolves the adapter origin
46-
from the runtime provider entry instead of pinning `api.meta.ai`.
47-
48-
`MUSE_CODE_ADAPTER=off` keeps the proxy in place and disables only the rewriting, so a base URL
49-
already observed by OpenClaw stays valid. If the adapter cannot bind, the plugin logs the failure
50-
and the provider keeps the direct `https://api.meta.ai/v1` endpoint.
17+
The official `@openclaw/meta-provider` plugin serves the same models but bills per-token API
18+
credits through `MODEL_API_KEY`; this plugin bills a subscription instead.
5119

5220
## Install
5321

@@ -57,7 +25,7 @@ From [ClawHub](https://clawhub.ai/plugins/@thestreamcode/openclaw-muse-code) (re
5725
openclaw plugins install clawhub:@thestreamcode/openclaw-muse-code
5826
```
5927

60-
From GitHub (requires the committed `dist/` runtime in the repository):
28+
From GitHub (ships the committed `dist/` runtime):
6129

6230
```bash
6331
openclaw plugins install git:github.com/TheStreamCode/openclaw-muse-code
@@ -86,10 +54,9 @@ openclaw plugins install --link .
8654
`openclaw models auth login --provider muse-code --method device-code --agent <id>`:
8755
credentials do not carry across agents.
8856

89-
2. Approve the code in the browser. If the browser does not open, use the displayed URL and code.
90-
OpenClaw saves an auth profile, and the plugin also writes its existing local cache at
91-
`~/.openclaw/muse-code-sub.json` (override with `MUSE_CODE_SUB_CREDENTIALS`). The key is never
92-
printed.
57+
2. Approve the code in the browser (or use the displayed URL and code). OpenClaw saves an auth
58+
profile, and the plugin keeps its local cache at `~/.openclaw/muse-code-sub.json` (override
59+
with `MUSE_CODE_SUB_CREDENTIALS`). The key is never printed.
9360
3. Select the provider in `~/.openclaw/openclaw.json`:
9461

9562
```json5
@@ -102,56 +69,63 @@ openclaw plugins install --link .
10269
}
10370
```
10471

105-
An explicit `MUSE_CODE_SUB_TOKEN` wins over the local cache when resolving the environment and
106-
catalog. OpenClaw normally selects a saved auth profile before the environment for inference, so
107-
after the browser login its profile may take precedence over both. Remove the profile if you need
108-
OpenClaw to use the environment credential instead:
72+
A saved OpenClaw auth profile takes precedence over `MUSE_CODE_SUB_TOKEN` and the cache for
73+
inference; remove the profile to force the environment credential:
10974

11075
```bash
11176
export MUSE_CODE_SUB_TOKEN=<key>
11277
```
11378

114-
The standalone `npm run login` script remains available in a source checkout. It updates the cache
115-
but not an existing OpenClaw auth profile; use the browser login above to replace that profile.
79+
In a source checkout, `npm run login` updates the cache only, not an existing auth profile.
80+
81+
## Features
82+
83+
- **Subscription billing.** Muse models in OpenClaw on the Muse Code subscription: device
84+
login, no API key.
85+
- **Live model catalog.** Discovery fetches `{baseUrl}/models` on a 60-second TTL; the table below
86+
is the pre-login fallback.
87+
- **Wire adapter.** A loopback adapter aliases tool names Meta's client gate rejects and normalizes
88+
validated Responses fields ([ADAPTER_CONTRACT.md](ADAPTER_CONTRACT.md)).
89+
- **Probes that work.** A 1024-token output floor and `none`/`off`-to-`minimal` mapping keep
90+
small requests and thinking-off turns accepted.
91+
- **Side-by-side installs.** Provider id `muse-code` never clashes with the official `meta`
92+
provider.
93+
- **Credential hygiene.** Owner-only cache, secrets never printed, OAuth token never written to
94+
disk.
11695

11796
## Models
11897

119-
| Model | Tier | Context |
120-
| --- | --- | --- |
121-
| `muse-code/muse-spark-1.3` | Standard (default) | 1,048,576 |
122-
| `muse-code/muse-spark-1.3-contributor` | Contributor | 1,048,576 |
123-
| `muse-code/muse-wonder-1.0` | Standard | 1,048,576 |
124-
| `muse-code/muse-wonder-1.0-contributor` | Contributor | 1,048,576 |
125-
| `muse-code/muse-wonder-full-1.0` | Standard | 1,048,576 |
126-
| `muse-code/muse-wonder-full-1.0-contributor` | Contributor | 1,048,576 |
127-
| `muse-code/muse-spark-1.2` | Standard | 1,048,576 |
128-
| `muse-code/muse-spark-1.2-contributor` | Contributor | 1,048,576 |
129-
| `muse-code/muse-spark-1.1` | Standard | 1,048,576 |
98+
| Model | Tier |
99+
| --- | --- |
100+
| `muse-code/muse-spark-1.3` | Standard (default) |
101+
| `muse-code/muse-spark-1.3-contributor` | Contributor |
102+
| `muse-code/muse-wonder-1.0` | Standard |
103+
| `muse-code/muse-wonder-1.0-contributor` | Contributor |
104+
| `muse-code/muse-wonder-full-1.0` | Standard |
105+
| `muse-code/muse-wonder-full-1.0-contributor` | Contributor |
106+
| `muse-code/muse-spark-1.2` | Standard |
107+
| `muse-code/muse-spark-1.2-contributor` | Contributor |
108+
| `muse-code/muse-spark-1.1` | Standard |
109+
110+
All models use a 1,048,576-token context window.
130111

131112
> [!WARNING]
132113
> Meta's [Terms of Service](https://dev.meta.ai/legal/terms-of-service) distinguish Standard
133114
> Services from Contributor and Discounted Services. By using Contributor tiers you permit Meta to
134-
> use submitted and generated content as described in the Terms. Do not submit sensitive,
135-
> confidential, or personal information to Contributor tiers. This plugin ships contributor
136-
> variants as selectable models but never selects them implicitly: the setup default is the
137-
> standard `muse-spark-1.3`.
115+
> use submitted and generated content as described in the Terms. Never submit sensitive,
116+
> confidential, or personal information to Contributor tiers; this plugin never selects them
117+
> implicitly and defaults to standard `muse-spark-1.3`.
138118
139-
Model discovery is live: the catalog is fetched from `GET {baseUrl}/models` with a 60-second
140-
in-memory TTL, and every returned model id is served except the endpoint families verified as
141-
non-chat (`sam-*`, `muse-image-*`, `muse-voice-*`). Newly published models appear automatically
142-
with no plugin update. The table above is the fallback used before login and whenever the live
143-
fetch fails.
119+
Discovery excludes the endpoint families verified as non-chat (`sam-*`, `muse-image-*`,
120+
`muse-voice-*`).
144121

145122
## Requirements
146123

147-
- OpenClaw gateway `>= 2026.7.1` for the provider and the device login command. The onboarding
148-
browser-login choice requires `>= 2026.9.5`; CI builds and tests against the pinned OpenClaw
149-
version on Node.js 24.
124+
- OpenClaw gateway `>= 2026.7.1` (`>= 2026.9.5` for the onboarding browser-login choice).
150125
- An active Muse Code subscription on the Meta account used at login. Pay-per-token API keys are
151126
the official plugin's path instead.
152-
- A loopback port the local adapter can bind (`127.0.0.1`, 43219-43222 preferred, otherwise an
153-
ephemeral port). Without it the plugin stays on the direct endpoint and Meta's tool-name gate
154-
applies again.
127+
- A bindable loopback port (`127.0.0.1`, 43219-43222 preferred, else ephemeral); without it
128+
the plugin stays on the direct endpoint and the tool-name gate applies again.
155129
- The Responses API transport with reasoning-effort mapping and text plus image input.
156130

157131
## Configuration
@@ -165,56 +139,39 @@ fetch fails.
165139

166140
## Privacy and security
167141

168-
- OpenClaw saves the inference credential in an auth profile. Recent versions can store it in the
169-
OpenClaw secret store; older versions store it inline in the profile. The plugin also maintains
170-
the cache for existing installs, so reference-only storage mode is not supported by this login.
142+
- OpenClaw saves the inference credential in an auth profile (secret store or inline). The
143+
plugin also maintains its cache, so reference-only storage is not supported.
171144
- The cache stores exactly three fields: the subscription `apiKey`, the `accountId`, and the
172145
account `email`. The Meta OAuth access token from the login flow is never written to disk; it is
173146
kept in memory only for the key exchange and then dropped.
174147
- The cache is created with owner-only permissions (`0600` where supported), and the login flow
175148
never prints secret material.
176-
- For cache-based resolution, the plugin exports the cached key as `MUSE_CODE_SUB_TOKEN` and
177-
refreshes it when the cache changes.
178-
- The plugin talks only to `auth.meta.com` for the device login and `api.meta.ai` for key minting
179-
and inference; both endpoints are hardcoded and there is no configurable endpoint. Inference
180-
goes through the loopback adapter described above, which listens on `127.0.0.1` only.
181-
- The adapter forwards the `Authorization` header unchanged and never reads, stores or logs
182-
credentials, request bodies or response bodies; its optional debug line carries only the method,
183-
the path, the status and the number of adapted fields.
149+
- The plugin exports the cached key as `MUSE_CODE_SUB_TOKEN` and refreshes it on cache
150+
changes.
151+
- The plugin talks only to hardcoded `auth.meta.com` (device login) and `api.meta.ai` (key minting,
152+
inference); inference goes through the loopback adapter on `127.0.0.1` only.
153+
- The adapter forwards `Authorization` unchanged and never reads, stores or logs credentials
154+
or bodies; its debug line carries only method, path, status and adapted-field count.
184155
- Report vulnerabilities privately per [SECURITY.md](SECURITY.md).
185156

186-
To remove access, delete `~/.openclaw/muse-code-sub.json` (or the path in
187-
`MUSE_CODE_SUB_CREDENTIALS`), unset any explicit `MUSE_CODE_SUB_TOKEN`, and remove the saved
188-
OpenClaw auth profile. On recent OpenClaw versions, run:
189-
190-
```bash
191-
openclaw models auth logout muse-code:default
192-
```
193-
194-
Use `openclaw models auth list` to find a different profile or agent. For older versions, follow the
195-
host's profile-removal documentation. Restart OpenClaw after removing access. Run `muse logout` if
196-
you also want to clear the Muse Code CLI session.
157+
To remove access: delete the cache file, unset `MUSE_CODE_SUB_TOKEN`, remove the saved auth
158+
profile (`models auth logout muse-code:default`; `models auth list` finds others), restart
159+
OpenClaw, and run `muse logout` for the CLI session.
197160

198161
## Troubleshooting
199162

200163
| Symptom | Cause | Fix |
201164
| --- | --- | --- |
202-
| `Muse Code subscription is inactive for this account` | Subscription lapsed or wrong account | Renew, or log in with the subscribed account |
203-
| `Muse Code subscription is required: <url>` | No subscription on the account | Complete checkout at the printed URL |
165+
| `Muse Code subscription is inactive` (or `required: <url>`) | Subscription lapsed, wrong account, or missing | Renew, check the account, or complete checkout at the printed URL |
204166
| `Login failed: access_denied` | Browser step denied or expired | Re-run login and approve within the expiry window |
205-
| `login timed out after slow_down responses` | Polling throttled, often VM clock drift | Check the system clock and retry |
206167
| Provider shows as unconfigured | No auth profile, environment key, or usable cache | Run the browser login above |
207168

208169
### Meta rejects subscription requests from this client
209170

210-
Meta may return a 403 mentioning `client_attestation_denied` or that Muse Code subscriptions cover
211-
the Muse Code client only. The plugin's loopback adapter aliases the tool names that trigger that
212-
gate, so the error should no longer appear for client tools whose names collide with Muse Code's
213-
builtin names. If it does appear, one of these is true: the adapter could not bind and the provider
214-
fell back to `https://api.meta.ai/v1` (the plugin logs the failure), `MUSE_CODE_ADAPTER=off` is set,
215-
or Meta changed the gate. It is a client restriction, not evidence of an expired key, and signing
216-
in again does not remove it. Use Muse Code for the subscription, or a separate pay-as-you-go Meta
217-
Model API key for other clients, subject to Meta's terms.
171+
Meta may return 403 `client_attestation_denied`: subscriptions cover the Muse Code client only. The
172+
adapter aliases colliding tool names (retrying once with all aliased), so the error should be gone;
173+
if it persists, the adapter could not bind, `MUSE_CODE_ADAPTER=off` is set, or Meta changed the
174+
gate. Use Muse Code or a pay-as-you-go key instead.
218175

219176
## Development
220177

@@ -229,15 +186,13 @@ npm test
229186
node scripts/smoke.discovery.mjs # static (pre-credential) and live discovery smoke
230187
```
231188

232-
`dist/` is committed because OpenClaw git and package installs require the compiled runtime;
233-
regenerate it with `npm run build` after any source change. CI runs type-check, build, unit tests,
234-
and a freshness check that fails when the committed `dist/` does not match a fresh build.
189+
`dist/` is committed for OpenClaw installs; regenerate it with `npm run build` after any source
190+
change (CI checks freshness).
235191

236192
## Support
237193

238-
Usage questions and workflows belong in GitHub Discussions; reproducible defects belong in GitHub
239-
Issues using the bug report form. See [SUPPORT.md](SUPPORT.md). Problems in OpenClaw or Meta
240-
themselves belong to their respective projects.
194+
Usage questions belong in Discussions, reproducible defects in Issues (bug report form). See
195+
[SUPPORT.md](SUPPORT.md). OpenClaw or Meta problems belong upstream.
241196

242197
## Contributing
243198

@@ -251,6 +206,6 @@ are compatible with the published behavior of oh-my-pi (MIT; see [NOTICE](./NOTI
251206

252207
---
253208

254-
Maintained by [Michael Gasperini (Mikesoft)](https://mikesoft.it).
209+
Maintained by Michael Gasperini (Mikesoft).
255210
If this project is useful to you, consider
256211
[sponsoring its maintenance](https://github.com/sponsors/TheStreamCode).

0 commit comments

Comments
 (0)