Repository navigation
Releases
v0.1.0 - first public release
muse-opencode v0.1.0
First public release. A local, OpenAI-compatible HTTP relay that drives your own muse.ai web chat through a real Chromium tab over the Chrome DevTools Protocol — no official API key involved.
What it does
- Runs a FastAPI server on
127.0.0.1:20233and translates OpenAI request shapes into real browser interactions. - Cookie-based auth: reuses the
hatch_sess/hatch_gw/hatch_native_auth_devicecookies from a normal muse.ai login, stored insession.json. - Browser-driven: a Chromium instance is launched with remote debugging, prompts are typed into the composer, reply bubbles are polled and streamed back as SSE.
- Multi-account: the pool handles rotation, cooldowns, and failover.
- Media: image generation and video tasks route through the same browser session.
Endpoints
| Method | Path | Purpose |
|---|---|---|
POST |
/v1/chat/completions |
Chat completions, streaming and non-streaming |
GET |
/v1/models |
Lists muse-chat and muse-image |
POST |
/v1/images/generations |
Image generation (n bounded 1-4) |
POST |
/v1/images/edits |
Returns FeatureNotImplemented (not supported upstream) |
POST |
/v1/videos |
Video task creation |
GET |
/v1/videos/{task_id} |
Video task status |
GET |
/v1/media/{name} |
Fetch generated media |
POST |
/v1/responses |
Stub |
GET |
/admin/status, /admin/accounts, /admin/tasks |
Admin state |
PATCH/DELETE/POST |
/admin/accounts* |
Account pool management |
POST |
/admin/accounts/{id}/reset, /renew |
Cooldown reset, cookie renewal |
POST |
/admin/tasks/{task_id}/cancel |
Cancel a media task |
Highlights in this release
Performance — 8 hot paths fixed
- Persistence no longer rewrites state on every read.
- Media size cap enforced before buffering.
- CDP event listeners are released instead of accumulating per request.
- Image generation fans out in parallel instead of serial.
- Thread affinity cache uses an LRU bound.
- Log spam on repeated polling removed.
- Fake usage numbers replaced with honest estimates (
usage.estimated: true).
Correctness — AGENTS.md leak and account pool healing
- Fixed: harness instructions (system/developer prompt blocks injected by the client) were being forwarded verbatim into the muse.ai chat thread.
core/prompt.pynow runsstrip_harness_noise()in bothflatten_messages()andmessage_turns(), so history matching and hot-page reuse stay consistent. Verified: a payload with a unique marker in a system message reaches muse.ai with zero marker occurrences, and the reply is clean. - Fixed:
no usable account in poolerrors under single-account setups. Four linked bugs inaccounts/pool.py(_candidates,acquire,_soonest_recovery,_apply_result),services/gateway.py(_should_retry), andaccounts/model.py(is_availablecooldown healing). - Fixed: a pre-existing
AttributeError: 'list' object has no attribute 'get'on the media path.
Docs
README.mdrewritten from scratch in English — 18 sections, TOC, copy-pasteable commands, architecture diagram, honest latency numbers, security model, disclaimer.AGENTS.mdreduced to a focused install guide (99 lines): headers and bullets, nothing else.
Install
git clone https://github.com/Nbill27/muse-opencode.git
cd muse-opencode
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .Log into muse.ai in Chrome, export the cookies into session.json, then:
.\start.ps1Verify:
curl.exe http://127.0.0.1:20233/healthz
curl.exe http://127.0.0.1:20233/v1/modelsSee README.md for the full manual install, opencode wiring, SDK usage, and troubleshooting.
Latency, honestly
The upstream model does the work. Measured on a local machine: non-streaming wall time ~28 s, of which ~24 s is muse.ai generation. Relay overhead is a few seconds (page open, typing, DOM polling). This is not a fast API, and no amount of tuning changes the floor.
Security model
- Binds
127.0.0.1only. require_api_key/require_admin_keyare deliberate no-ops on loopback — this is a single-operator local tool, not a multi-user service.session.jsonis gitignored. It is a live credential. Never commit it.- Not a way to bypass authentication: it reuses a login cookie you already own.
Requirements
- Windows (primary target), Python 3.10+
- Google Chrome installed
- An active muse.ai account
For Educational Purposes Only
This project is published for educational and research purposes. It is not affiliated with, endorsed by, or supported by muse.ai. It wraps a web UI that has no public API. Use it only with accounts you own, respect the service's terms, and understand that upstream changes can break it at any time. The authors accept no liability for misuse or for any consequence of using this software.
Full changelog: 16667bb...e276b8b