Muse Spark OpenRouter Patch
This package makes Meta Muse Spark work as a Codex model through OpenRouter. It fixes two failure modes without embedding an API key in source or Codex configuration:
- Codex can inherit a stale
OPENROUTER_API_KEY, causing OpenRouter to return401 User not foundeven after a new key was entered elsewhere. - Muse Spark rejects Responses API function names longer than 64 characters. Codex namespaces are flattened with a separator, so two individually valid namespace/tool components can become a 66-character provider name and make an otherwise-valid request fail before inference with HTTP 400.
The local proxy deterministically shortens overlong names on requests and
restores their original names on JSON and SSE responses. Authorization headers
are forwarded but never logged. The key is stored in a mode-0600 file and is
supplied to Codex through its supported auth.command mechanism.
Install
The simplest installation is the Bash installer. It installs only for the current user and prompts for the OpenRouter key without echoing it:
curl -LsSf https://session-migrate.github.io/muse-spark-openrouter/install.sh | sh
To install the commands without changing Codex yet, or from a local release checkout:
curl -LsSf https://session-migrate.github.io/muse-spark-openrouter/install.sh | sh -s -- --install-only
sh install.sh --install-only
The equivalent manual installation is:
uv tool install muse-spark-openrouter-patch
muse-spark-openrouter setup --set-default
muse-spark-openrouter doctor --live
The package is also installable in an isolated environment with
pipx install muse-spark-openrouter-patch. The Bash installer prefers the
version pinned on PyPI and falls back to the checksum-pinned release wheel.
setup prompts without echo. For automation, pass the key on standard input so
it does not appear in shell history or the process list:
printf '%s\n' "$OPENROUTER_API_KEY" | muse-spark-openrouter setup --key-stdin
Run Codex with the installed profile:
codex-muse
codex-muse exec --ephemeral "Reply with exactly OK"
The default model is meta/muse-spark-1.2. Choose another OpenRouter Muse
Spark slug during setup with --model.
Docker
The proxy contains no credential and can run read-only:
docker compose up -d --build
Point an OpenAI Responses-compatible client at
http://127.0.0.1:8787/api/v1 and continue sending its OpenRouter bearer token
normally.
Security notes
- The proxy binds to
127.0.0.1by default. - It does not persist, print, or log authorization headers or request bodies.
- The credential lives at
${XDG_CONFIG_HOME:-~/.config}/muse-spark-openrouter/credentialwith mode0600. - Rotate any API key that has been pasted into a chat, issue, or terminal log.
Development and release
uv run --with pytest pytest
uv build
docker build -t muse-spark-openrouter-patch:0.1.0 .
Artifacts are pure Python wheels/source archives and work on Linux, macOS, and
Windows. The systemd user-service setup is Linux-specific; other platforms use
the launch-on-demand codex-muse wrapper.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file muse_spark_openrouter_patch-0.1.0.tar.gz.
File metadata
- Download URL: muse_spark_openrouter_patch-0.1.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1831388e08852a706a3be10bdfd200047f539e61782d6c9ffcc11b35d396425
|
|
| MD5 |
eccb5c4d8fcce66c225fa0dca48af3e3
|
|
| BLAKE2b-256 |
6869fdbe983f85685ea0c7dcbee8e371fe637a2e6d9290f0294db1c3177bf27d
|
File details
Details for the file muse_spark_openrouter_patch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: muse_spark_openrouter_patch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d4f3701da9e9fe8c0350a9bc56e3b1b2e7cebe43902069d45874839d7e07f8b
|
|
| MD5 |
a13f4cd76024c1f0f1a8a14216157a84
|
|
| BLAKE2b-256 |
b831000757011f4a44258f81fbc2bb446b8038824e7ada169ade63dc21e34ba4
|