d4ncboz / museai
git clone https://github.com/d4ncboz/museai.git
High-performance OpenAI-compatible API gateway and bridge for muse.ai personal AI agents, ready for 9Router multi-model integration.
+3
stars, 24h · #8,270
+~12
stars, 7 days · #11,107
+150
stars, 30 days · #4,975
150
★ total · +9% this week
8
forks · 0 open issues
Star history (as recorded here)
LanguagePython
LicenseMIT
Created2026-09-29 (24d ago)
Last push24d ago
Watchers0
OwnerUser
Links
- GitHub: github.com/d4ncboz/museai
- Releases · Issues · Hacker News mentions
README excerpt
Muse AI
OpenAI-compatible API gateway for muse.ai personal workspaces, featuring native 9Router integration.
---
## Architecture
[code]
---
## Technical Highlights
- **OpenAI Wire Compatibility**: Direct drop-in for OpenAI SDKs, LangChain, LobeChat, NextChat, Cherry Studio, and autonomous coding agents.
- **Native 9Router Provider**: Ships with `scripts/connect_9router.py` to auto-register model routes directly into 9Router's SQLite database (`~/.9router/db/data.sqlite`).
- **Resilient Cookie Injection**: Automatically URL-decodes percent-encoded cookie tokens (`%3A` -> `:`) and registers sessions across dual-domain scopes (`.muse.ai` and `muse.ai`) via CDP.
- **Meta Edge Proxy Compliance**: Supports `datr` cookie passing to prevent device-integrity redirects on Meta infrastructure.
- **Account Pooling & Failover**: Multi-account scheduling (`affinity`, `lru`, `round_robin`), concurrency limits, automatic error cooldown, and transparent retries.
- **Deterministic Offline Testing**: 100% offline test suite powered by `MockDriver` (23 passed in `Application` ──> `Cookies` ──> `https://muse.ai`):
- `hatch_sess`: Session authentication token
- `hatch_gw`: Gateway routing cookie
- `hatch_native_auth_device`: Registered device UUID
- `hatch_vml`: Workspace lease token *(optional/dynamic)*
- `datr`: Meta device verification cookie *(recommended)*
### Import via Admin API
[code]
Alternatively, use the helper script to convert raw Netscape / DevTools JSON exports:
[code]
---
## 9Router Multi-Model Gateway Hook
To register `museai` into a local 9Router instance:
[code]
Call the model through 9Router immediately:
[code]
Available model IDs routed by 9Router:
- `muse/muse-chat`: Primary personal agent conversational model
- `muse/gpt-4o`: OpenAI tooling alias
- `muse/gpt-5`: High-reasoning alias
- `muse/claude-sonnet-4`: Sonnet alias
- `muse/muse-video`: Text / first-frame image-to-video
---
## API Usage
### Streaming Chat Completion (`curl`)
[code]
### Python SDK (`openai`)
[code]
---
## Endpoints
| Method | Route | Description |
|---|---|---|
| `GET` | `/healthz` · `/readyz` | Service liveness and driver readiness checks |
| `GET` | `/v1/models` | OpenAI-compliant model catalog and alias mapping |
| `POST` | `/v1/chat/completions` | Multi-turn chat (streaming SSE & buffered JSON) |
| `POST` | `/v1/images/generations` | Text-to-image synthesis |
| `POST` | `/v1/videos` | Asynchronous video generation task dispatch |
| `GET` | `/v1/videos/{id}` | Task status polling |
| `GET/POST` | `/admin/accounts` | Account pool CRUD and session renewal |
| `GET` | `/admin/status` | Real-time driver stats, tabs, and pool health |
---
## Development & Testing
[code]
See AGENTS.md for machine-readable architecture contracts, protocol framing, and contribution guidelines.
---
## License
MIT © 2026 D4NNBOZ