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.
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:
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:os.environ["MELIAI_API_KEY"] (Python) or process.env.MELIAI_API_KEY (Node.js), as shown in the examples above.
Additional key-storage options
Additional key-storage options
.envfiles — use a library such aspython-dotenvordotenvfor Node.js, and add.envto 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.