Key security
Your mdf-… key is like a password that authorizes spending: whoever has it uses your credit. Here are the best practices to never let it leak.
The golden rules
- Never put it in code: use an environment variable (
API_AI_KEY). - Never publish it: public repository, screenshot, support message, discussion thread.
- Never embed it in a browser or mobile application: anything shipped to the user can be read.
- A compromised key is renewed immediately (see Key lifetime and renewal).
Where to store the key
| Context | Best practice |
|---|---|
| Development machine | An environment variable in your shell profile, or a .env file added to .gitignore |
| Continuous integration | The platform’s secret store (GitHub Actions secrets, GitLab CI variables…) |
| Production | A secrets manager (1Password, Doppler, AWS Secrets Manager, Vault…) |
| Web or mobile application | Never inside the app: call the API from your own server |
Calling the API from your server
For a web application, your server receives the user’s request and calls the API with the key, which never leaves the server:
ts
// Node.js example (server) — the key stays in the server's environment
app.post('/api/assistant', async (req, res) => {
const r = await fetch('https://api-ai.app/v1/messages', {
method: 'POST',
headers: {
'x-api-key': process.env.API_AI_KEY!,
'anthropic-version': '2023-06-01',
'content-type': 'application/json'
},
body: JSON.stringify({
model: 'claude-sonnet-5-5',
max_tokens: 1024,
messages: [{ role: 'user', content: req.body.question }]
})
})
res.status(r.status).json(await r.json())
})Add your own authentication and a rate limit on that server: without them, anyone could use your assistant and spend your credit.
Detecting a leak
- Watch your dashboard: unusual consumption, models you do not use, or a balance dropping for no reason are warning signs.
- Search for the key in your repository history (
git log -S "mdf-") and in your configuration files. - Enable secret detection on your code hosting platform.
If your key leaked
- Ask for a renewal at admin@minedom-france.fr from your purchase address: the old key is revoked immediately.
- Replace the key everywhere (tools, CI, servers).
- Remove it from the repository history if it appears there, then treat it as permanently compromised.
Never send your full key to support
To identify your key, give only its first 8 characters. We will never ask you for the whole key.
Going further
Last updated: October 4, 2026Found a bug? admin@minedom-france.fr