Skip to main content
Every request to the Meliai API must be authenticated with an API key. Keys are tied to your account and control access to all endpoints — from chat completions to batch jobs. Meliai follows the same header conventions as OpenAI and Anthropic, so if you’re migrating an existing client you only need to swap the key value and the base URL.

Getting an API key

1

Open the API keys page

Go to https://meliai.ai/account/api/keys and sign in to your Meliai account.
2

Create a new key

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

Copy your key immediately

Your key is displayed once. Copy it now and store it somewhere safe — Meliai cannot show it to you again. If you lose it, you must create a new one.
API keys are shown only once at creation. Store your key in a password manager or secrets manager immediately. If you lose a key, revoke it and generate a replacement at https://meliai.ai/account/api/keys.

Using your API key

Meliai accepts your key in either of two header formats — both work on every endpoint: The following examples show how to authenticate with the OpenAI SDK (Python and Node.js) and with a raw HTTP request:
If you prefer the x-api-key header style (common with Anthropic clients), use:

Storing your key safely

Keep your API key out of source code and version control. The recommended approach is to use an environment variable:
Then read it in your application with os.environ["MELIAI_API_KEY"] (Python) or process.env.MELIAI_API_KEY (Node.js), as shown in the examples above.
  • .env files — use a library such as python-dotenv or dotenv for Node.js, and add .env to your .gitignore.
  • CI/CD secrets — store the key as an encrypted secret in GitHub Actions, GitLab CI, or your deployment platform.
  • Cloud secret managers — AWS Secrets Manager, Google Secret Manager, Azure Key Vault, and HashiCorp Vault all support automated key rotation and fine-grained access control.
If you believe a key has been exposed, rotate it immediately at https://meliai.ai/account/api/keys. Revoked keys stop working instantly.

Auth errors