Authentication

Every request to Meta Model API needs an API key. Add your key and start building.

Get an API key

Create and manage keys in the Model API dashboard:

  1. Log in and open the API keys tab.
  2. Click Create API key, give it a descriptive name, and click Create.
  3. Copy the key right away. You only see it once.

API keys look like this:

API key format
LLM|607358788850350|nx9.....LJY

Use an API key

Pass the key as a Bearer token in the Authorization header:

curl
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"}]
}'

Keep the key out of your code. Store it in an environment variable:

shell
export MODEL_API_KEY="LLM|607358788850350|nx9.....LJY"

See Get started for a full walkthrough.

The official SDKs read MODEL_API_KEY automatically when you don't pass a key to the client.

Revoke an API key

Remove access in the Model API dashboard: click Delete next to the key you want to revoke. Deleting one key leaves other team keys untouched.

API key safety

A leaked key can burn your team's rate limits, access uploaded files, and send requests on your behalf. Lock it down with these practices:

  1. Use unique keys per application: create a separate key for each app or developer so you can revoke one without breaking the rest.
  2. Keep keys out of client code: mobile and browser code is visible to users. Proxy requests through a server you control.
  3. Never commit keys to version control: load them from environment variables or a secrets manager, and add credential files to .gitignore.
  4. Use environment variables or a key manager: centralize secrets so rotation stays simple and keys stay out of source files.
  5. Monitor for anomalies: watch usage for unexpected spikes that suggest a leak, then revoke and rotate immediately.
Shared team rate limits

Keys on the same team share rate limits. See Pricing and rate limits for details.