Set up Muse Code and control your token bill

Muse Code runs coding tasks in your terminal or CI. Start it in a project you trust, then choose the credential that should pay for the run. An exported API key takes precedence over a subscription login. Before automating a task, set a step limit and choose the test that will check its result.

Last updated . CWYN is an independent publisher and is not affiliated with, endorsed by, or sponsored by Meta.

Muse Code API cost calculator

1. Install Muse Code and open a project

Muse Code is Meta’s coding agent for Muse Spark. This guide is based on Meta’s published documentation. Checked . Muse Code overview and installation.

On macOS or Linux, run:

curl -fsSL https://dev.meta.ai/install.sh | bash

On Windows, run this in PowerShell:

irm https://dev.meta.ai/install.ps1 | iex

Run muse --version to check the installation. Open your project directory and run muse. Confirm that you trust the workspace, then sign in through the browser or paste an API key. Use /login to reopen sign-in.

2. Check which account pays for a run

Muse checks credentials in this order. If you expect a CLI subscription to cover a run, check for a key first. Authentication and billing.

  1. An exported META_API_KEY takes precedence over stored credentials.
  2. A key saved with muse auth set takes precedence over browser sign-in.
  3. With neither key present, Muse uses the stored browser session. Sign in with the Model API account that holds your subscription.

muse logout clears stored credentials. An exported key stays in your environment until you remove it. Meta Managed Accounts require an API key.

Compare API rates and monthly subscriptions

With an API key, the bill depends on fresh input, cached input and output. Check your muse settings or select the model with --model. Meta lists Spark 1.3 as the latest version. Spark 1.1 shares the Standard rates below. Muse Spark model versions.

API dollars per million tokens · Checked Nov 28, 2026
ModelFresh inputCached inputOutput
Muse Spark 1.3 / 1.2 (Standard)
muse-spark-1.3
$1.25$0.15$4.25
Muse Spark 1.3 / 1.2 (Contributor)
muse-spark-1.3-contributor
$0.10$0.002$0.20
Muse Wonder (Standard)
muse-wonder-1.0
$4.00$0.20$20.00

Contributor mode lets Meta use prompts, code, files and responses to train future models. Standard mode excludes them from training. Spark and Wonder have a one-million-token context window with no long-context premium. Meta excludes its injected system prompt and steering context from token charges. Web search grounding carries a separate charge. Meta pricing and rate limits.

Muse Code CLI subscriptions · Checked Nov 28, 2026
PlanMonthly priceAllowance
Everyday Usage$510–50 prompts every five hours
High Usage$155× Everyday
Power Usage$5020× Everyday, includes Muse Wonder Full
Maximum Usage$20080× Everyday

Both a five-hour allowance and a weekly allowance apply. Meta has not published the weekly limits. Run muse usage to see usage and reset times without starting a model turn. Subscriptions default to Contributor mode, which you can turn off in settings. The subscription covers the signed-in CLI. Calls with additional API keys are billed separately. Muse Code subscriptions.

3. Cap headless work and test the result

In CI, supply the API key from a secret. This example allows at most six model steps. Replace the prompt and the test command with ones for your repository. Headless runs and CI.

META_API_KEY="$MUSE_KEY" muse exec --max-model-steps 6 "Review the staged changes" && npm test

Use muse exec --prompt-file task.txt to read a task from a file. Add --json for JSONL output. Exit 0 means the turn completed. Gate CI on your own tests to check the work. Exit 1 means failure or cancellation, including reaching the step cap. Exit 2 signals a usage error. SIGINT and SIGTERM produce 130 and 143 respectively.

--max-model-steps caps headless runs. Use --reasoning-effort to choose the depth for the task and --contributor-mode on or off to choose the data policy for one run. --disable-approval skips approval prompts while keeping the sandbox. --yolo removes both protections. Reserve it for disposable containers. Launch flags.

Keep your token bill down

  • Keep shared instructions at the start of the prompt and append the changing task. At the Spark Standard rate, cached input costs $0.15 per million tokens versus $1.25 fresh, about one eighth as much. Checked Nov 28, 2026.
  • Compact the context before the next task. Keep the relevant files, decisions and failing test output.
  • Set a step cap on each muse exec run. Also limit retries in the calling script so it cannot start an unlimited series of capped runs.
  • Compare the estimate with the token counts from your own workload. Estimate Muse Code API costs.

All Muse Code guides