GUIDE· 5 min read

Muse Code API key: how to create one, use it in CI, and what it costs

Muse Code can sign in with a browser or an API key, and the key is also your way into Meta’s Model API. How to create a key, the environment variable each tool expects (META_API_KEY vs. MODEL_API_KEY), base URLs, per-token prices, rate limits, and the mistakes that cause surprise bills.

#api#model-api#authentication#ci#pricing

One key, two uses

A Meta Model API key does two jobs. It can sign in Muse Code, Meta’s terminal coding agent, instead of the browser flow — the normal choice for CI, servers, and scripts. And it can call the Meta Model API directly, the same models Muse Code runs on, from your own code or from other coding agents.

The two uses read the key from different environment variables, which trips people up:

You’re using… Variable Notes
The Muse Code CLI (muse, muse exec) META_API_KEY Or store it once with muse auth set
The Model API from your own code, OpenCode, or Codex MODEL_API_KEY The name Meta’s examples use; SDKs don’t read it automatically, so pass it explicitly
Claude Code on Meta’s models ANTHROPIC_AUTH_TOKEN Set it to your Model API key

Create a key

  1. Sign in to the Meta Model API dashboard at dev.meta.ai with your Meta developer account.
  2. Open the API keys tab and click Create API key.
  3. Give it a name that says where it will live — ci-github-actions beats key1 — and click Create.
  4. Copy it immediately. Meta shows the key only once.

Keys start with LLM_, followed by a numeric ID and the secret. If your account was created through Meta’s Business & Enterprise sign-up, browser sign-in isn’t available to you at all, so an API key is the only way to use Muse Code — ask a team admin to create one.

Use it with Muse Code

On your own machine you can save the key once:

muse auth set

Everywhere else, especially CI, inject it from your secret store as META_API_KEY:

META_API_KEY="$MUSE_KEY" muse exec --json "fix the failing test in tests/date.test.ts"

Muse Code looks for credentials in a fixed order: META_API_KEY first, then a stored key, then a stored browser session. If an environment key is hiding a browser session you meant to use, Muse Code says so. /login reopens the sign-in options inside a session, and muse logout clears the stored session and stored key — but not a META_API_KEY you exported in your shell, so unset that yourself.

Two CI details are worth knowing. muse exec exits with code 0 when the turn finishes, which isn’t the same as the work being right, so gate merges on your own tests. And on Linux runners the sandbox needs bubblewrap and a non-musl build; Alpine-based images won’t run shell commands. Our CLI cheat sheet lists the other muse exec flags.

What an API key costs in Muse Code

A key is pay-as-you-go: every token is billed at Model API rates, separately from any monthly plan. Meta’s subscription docs say usage through extra API keys is billed this way even if you also subscribe, so a key in your CI won’t draw from your plan’s allowance. Charges are taken when your balance reaches a payment threshold and on the first of each month for whatever is left; the Usage dashboard shows where the tokens went, and Pay now on the Billing page settles early.

Two things a key can’t do: it can’t reach Muse Wonder Full, which is only available on the Power and Maximum plans, and it doesn’t come with the plans’ request-based allowance.

Prices per model

Per 1M tokens, from Meta’s pricing page on October 25, 2026:

Model Input Cached input Output
muse-wonder-1.0 $4.00 $0.20 $20.00
muse-spark-1.3 $1.25 $0.15 $4.25
muse-spark-1.3-contributor $0.10 $0.002 $0.20

The Contributor model is the same Muse Spark 1.3 at a fraction of the price, because Meta may use the data to train future models. There is no Contributor version of Muse Wonder. Muse Image costs $0.01 per image, and web search grounding adds $2.50 per 1,000 searches. Our estimator turns token volumes into a monthly bill, and Contributor vs. Standard covers the privacy side of that choice.

Rate limits

Limits apply per team, not per key, so creating more keys doesn’t buy more throughput:

Model Requests / minute Tokens / minute
muse-wonder-1.0 3,000 4,000,000
muse-spark-1.3 3,000 4,000,000
muse-spark-1.3-contributor 150 3,000,000

The Contributor model’s 150 requests a minute is the one to watch if you fan out many parallel agents on it.

Call the Model API directly

The API speaks the formats other tools already use. For OpenAI-style clients the base URL is https://api.meta.ai/v1; for Anthropic-style clients it’s https://api.meta.ai, with no /v1. A first request:

curl https://api.meta.ai/v1/chat/completions \
  -H "Authorization: Bearer $MODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "muse-spark-1.3", "messages": [{"role": "user", "content": "Hello"}]}'

The same key works in OpenCode, Codex, and Claude Code with the configurations in our docs. If calls start failing, https://api.meta.ai/v1/status reports the API’s health and each model’s availability without needing a key.

Keep the key safe

  • Store it in your CI’s secret store or a password manager, never in the repository or in AGENTS.md.
  • Use one key per place it lives, so you can revoke a leaked CI key without breaking your laptop.
  • Pass it as an environment variable for the single command that needs it, as in the muse exec example above, rather than exporting it in a shared shell profile.
  • If a key leaks, delete it in the dashboard and create a new one — it can run up a bill on your account.
Keep reading