Skip to main content
Every request to the Meliai API must include your API key. Meliai accepts two header formats — the standard Authorization: Bearer token used by OpenAI-compatible clients, and the x-api-key header used by Anthropic-compatible clients. Both headers are accepted on every endpoint, so you can use whichever format your existing SDK or HTTP client already sends.

Supported Header Formats

Both of the following headers are equivalent and accepted on all Meliai endpoints:
Store your key in the MELIAI_API_KEY environment variable and reference it from your code — never hard-code it in source files.
Never commit API keys to source control or include them in client-side code. Store keys in environment variables or a dedicated secrets manager such as AWS Secrets Manager, HashiCorp Vault, or your CI/CD platform’s secret store.

SDK and curl Examples

The examples below show how to configure each client to point at the Meliai base URL and pass your key. Because Meliai is OpenAI-compatible, the standard openai SDK requires only a base_url swap.

Creating API Keys

Generate and manage your API keys in the Meliai dashboard. When you create a key, the full secret value is shown only once — copy it immediately and store it securely. If you lose a key, revoke it and generate a new one.
1

Open the API Keys page

Navigate to meliai.ai/account/api/keys and sign in.
2

Create a new key

Click New API Key, give it a descriptive name (for example, prod-backend or dev-local), and confirm.
3

Copy and store the key

Copy the key immediately — it will not be shown again. Add it to your environment as MELIAI_API_KEY.
4

Revoke keys you no longer need

Delete unused keys from the dashboard to reduce your attack surface. Revoking a key takes effect immediately.

Error Responses

Authentication failures return a structured JSON error with one of the following HTTP status codes: See the Errors page for the full error response shape and a complete list of error codes.