Skip to main content

Muse Code OpenRouter

Use an OpenRouter API key and any meta/muse* model directly inside Meta Muse Code. After setup, the normal muse command uses meta/muse-spark-1.2 through OpenRouter by default; no Codex configuration is involved.

Why an adapter is needed

Muse Code 0.2.1 exposes a --base-url option but the shipped binary only enables its meta and echo providers. Pointing that Meta provider straight at OpenRouter fails before inference because Muse first requests the proprietary /muse-code/models catalog. Muse also requires a sequence_number on each Responses API stream event, which compatible providers do not always emit.

The local adapter fixes those protocol differences:

  • translates OpenRouter's live meta/muse* catalog into Muse's model catalog;
  • replaces Muse's endpoint with a loopback-only Responses API adapter;
  • supplies the OpenRouter credential without putting it in Muse's Meta auth store;
  • preserves the requested meta/muse* model instead of pinning one model;
  • clamps Muse's output budget to each advertised model limit;
  • adds missing stream sequence numbers; and
  • shortens and restores provider-incompatible function names when necessary.

Install

curl -LsSf https://xhluca.github.io/muse-code-openrouter/install.sh | sh

The installer installs Meta's official Muse Code launcher if muse is missing, installs this package for the current user, and prompts for the OpenRouter key without echoing it. Afterwards, use Muse Code normally:

muse

List every currently available Meta Muse model and mark the configured default:

muse-openrouter models

Select any listed model for a run without reconfiguring the adapter:

muse --model meta/muse-glimmer-30b
muse --model meta/muse-spark-1.1
muse --model meta/muse-spark-1.2
muse --model meta/muse-spark-1.2-contributor

The catalog is fetched live, so newly released meta/muse* models appear automatically. OpenRouter account privacy settings and provider availability still apply. In particular, the Contributor model allows prompts and outputs to be used to improve Meta's products and may be blocked by restrictive OpenRouter data policies.

Manual installation is also supported:

uv tool install muse-code-openrouter
muse-openrouter setup
muse-openrouter doctor --live

For automation, supply the key on standard input so it does not appear in shell history or the process list:

printf '%s\n' "$OPENROUTER_API_KEY" | muse-openrouter setup --key-stdin

What setup changes

  • Stores the key at ${XDG_CONFIG_HOME:-~/.config}/muse-code-openrouter/credential, mode 0600.
  • Preserves Muse's other settings while updating provider, model, and endpoint_transport in ~/.config/muse/settings.json.
  • Removes any old static model catalog so Muse reads the adapter's live meta/muse* catalog.
  • Saves the original Muse settings under ${XDG_STATE_HOME:-~/.local/state}/muse-code-openrouter/.
  • Starts a loopback-only adapter on 127.0.0.1:8817, normally as a systemd user service on Linux.

The adapter never logs API keys, authorization headers, prompts, request bodies, or model responses. Muse session logging remains controlled by Muse itself.

Development

uv run --with pytest pytest
uv run --with ruff ruff check .
uv build

The adapter is dependency-free Python and supports Linux and macOS. The service installer uses systemd when available and otherwise launches a detached process.

Download files

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

Source Distribution

muse_code_openrouter-0.2.1.tar.gz (16.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_code_openrouter-0.2.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file muse_code_openrouter-0.2.1.tar.gz.

File metadata

  • Download URL: muse_code_openrouter-0.2.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for muse_code_openrouter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ed0791ca4c8cb7d3bbc4ac2068ce6ede29aea7dc7375fbe3212d5ad21fd9af77
MD5 709e8c9c0769de56319d4662b44fd98e
BLAKE2b-256 329c47e5b4b55b9d0ea5830d0bac8794f4d31863f49c0ff595b8dfbfe626870d

See more details on using hashes here.

File details

Details for the file muse_code_openrouter-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for muse_code_openrouter-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 259f0023433113c40ecff0872bb650e8ef42d606c18bdaced3a46de485cdc55b
MD5 b6a476f351b35a93cb343eb9ad081a7a
BLAKE2b-256 6ae9c6ec64b409ae3f9250f4699d67a8edfaa39949ddf0af3d8389e128c5852a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

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