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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muse_spark_openrouter_patch-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muse_spark_openrouter_patch-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file muse_spark_openrouter_patch-0.1.0.tar.gz.

File metadata

File hashes

Hashes for muse_spark_openrouter_patch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1831388e08852a706a3be10bdfd200047f539e61782d6c9ffcc11b35d396425
MD5 eccb5c4d8fcce66c225fa0dca48af3e3
BLAKE2b-256 6869fdbe983f85685ea0c7dcbee8e371fe637a2e6d9290f0294db1c3177bf27d

See more details on using hashes here.

File details

Details for the file muse_spark_openrouter_patch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muse_spark_openrouter_patch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d4f3701da9e9fe8c0350a9bc56e3b1b2e7cebe43902069d45874839d7e07f8b
MD5 a13f4cd76024c1f0f1a8a14216157a84
BLAKE2b-256 b831000757011f4a44258f81fbc2bb446b8038824e7ada169ade63dc21e34ba4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page