Authentication and billing
Muse Code needs a Meta credential before it can call the model. On first run it prompts you to choose how to authenticate: a browser sign-in or an API key. For scripts and CI, use an API key.
Sign in
The first time you run Muse Code, start it in your project:
bashmuse
On first run, Muse Code prompts you to authenticate and offers two options:
- Sign in with your browser: opens your web browser to approve the session, then returns you to the terminal.
- Paste an API key: paste a Meta API key directly, without the browser flow.
Muse Code stores the credential for you and resumes where you stopped. Reopen these options any time from an interactive session with /login.
Use an API key
For a non-interactive environment, or to avoid the browser flow, authenticate with an API key. Set it in the environment:
bashexport META_API_KEY="<your-key>"
Or store it with:
bashmuse auth set
An API key always takes priority over a browser sign-in. Muse Code uses META_API_KEY if set, then a stored key, and only then a stored browser session. If an environment key hides a browser session you created, Muse Code tells you.
Authenticate in CI
A pipeline has no browser, so provide META_API_KEY in the environment (from your CI secret store):
bashMETA_API_KEY="$MUSE_KEY" muse exec "Run the test suite and summarize failures."
See headless and CI for non-interactive runs.
Sign out
Remove the stored Meta credential with:
bashmuse logout
muse logout clears the stored browser session and any stored key. It does not unset a META_API_KEY you exported in your environment. Remove that from your shell or secret store separately.
Billing and plans
Billing setup
Meta Model API billing is usage-based: you're billed for the tokens your requests consume. This page explains how to set up billing and how charges work. For step-by-step instructions, see how to set up billing and download invoices in the Help Center.
Prefer a flat monthly rate instead of pay-as-you-go pricing? See subscriptions.
How to add payment
A team admin needs to complete two steps:
- Add a payment method. Go to Billing and add a payment method. See How to set up billing for detailed instructions.
- Create an API key. See Authentication for instructions.
Only team admins can manage payment methods and business information.
How billing works
Charges are based on token usage. Every request consumes:
- Input tokens: your prompt, system instructions, and conversation history.
- Output tokens: the text the model generates. Output tokens typically cost more than input tokens.
Costs may vary by model. For current per-model rates, see Pricing and rate limits.
When you're charged
Charges accrue as you use the API. Your payment method is charged in one of two situations:
- Payment threshold reached. Whenever your current balance reaches your payment threshold amount, your payment method is charged for that amount. As you make successful payments, your payment threshold may be raised until your account reaches a final threshold amount.
- Monthly bill date. Any remaining balance is automatically charged on the first of each month.
If you have a current balance, you can use Pay now on the Billing page to make an early payment before you reach your payment threshold or monthly bill date.
Next steps
- Start your first session in the overview.
- Set your default model and preferences in configuration and context.