Skip to main content

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:

  1. Codex can inherit a stale OPENROUTER_API_KEY, causing OpenRouter to return 401 User not found even after a new key was entered elsewhere.
  2. 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.1 by default.
  • It does not persist, print, or log authorization headers or request bodies.
  • The credential lives at ${XDG_CONFIG_HOME:-~/.config}/muse-spark-openrouter/credential with mode 0600.
  • 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.

Metadata

Release files for muse-spark-openrouter-patch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muse-spark-openrouter-patch 0.1.0
File Size Uploaded
muse_spark_openrouter_patch-0.1.0.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for muse-spark-openrouter-patch 0.1.0
File Interpreter ABI Platform
muse_spark_openrouter_patch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / muse_spark_openrouter_patch-0.1.0.tar.gz

Download URL muse_spark_openrouter_patch-0.1.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1831388e08852a706a3be10bdfd200047f539e61782d6c9ffcc11b35d396425
BLAKE2b-256 checksum
How to use checksums
6869fdbe983f85685ea0c7dcbee8e371fe637a2e6d9290f0294db1c3177bf27d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / muse_spark_openrouter_patch-0.1.0-py3-none-any.whl

Download URL muse_spark_openrouter_patch-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d4f3701da9e9fe8c0350a9bc56e3b1b2e7cebe43902069d45874839d7e07f8b
BLAKE2b-256 checksum
How to use checksums
b831000757011f4a44258f81fbc2bb446b8038824e7ada169ade63dc21e34ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page