Authentication
The Mira API uses bearer-token authentication. Every request to a protected endpoint must carry a valid API key in the Authorization header.
Get a key
Sign in at platform.vmira.ai/api-keys and click Create key. Keys are shown only once at creation time — store them in a password manager or your CI/CD secret store immediately.
Key format
format
sk-mira-{40 hex characters}Total length is 48 characters. The sk-mira-prefix is constant; anything that doesn't match it isn't a Mira key.
Sending the key
Pass the key in the HTTP Authorization header using the bearer scheme:
header
Authorization: Bearer sk-mira-...bash
curl https://api.vmira.ai/v1/chat/completions \
-H "Authorization: Bearer $MIRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mira",
"messages": [{"role": "user", "content": "Hello"}]
}'python
from openai import OpenAI
client = OpenAI(
api_key="sk-mira-...",
base_url="https://api.vmira.ai/v1",
)
print(client.chat.completions.create(
model="mira",
messages=[{"role": "user", "content": "Hello"}],
).choices[0].message.content)Environment variables
Recommended pattern: read the key from MIRA_API_KEY at startup and never commit it to source control.
shell
# Linux / macOS
export MIRA_API_KEY="sk-mira-..."
# Windows (PowerShell)
$env:MIRA_API_KEY = "sk-mira-..."
# .env file (Next.js, Vite, etc.) — add .env* to .gitignore
MIRA_API_KEY=sk-mira-...Security best practices
- Server-side only — API keys must never appear in browser JavaScript, mobile bundles, or public repos. If you need browser access, proxy through your own backend.
- Environment variables — Keep keys in environment variables (or your CI/CD secret store), not in source code.
- Rotate periodically — Rotate keys on a schedule and whenever a teammate with access leaves the project.
- Separate keys per env — Dedicated keys for dev, staging, and production make incident response far simpler.
- Revoke immediately if leaked — Treat any key that appears in a public commit, Slack message, or screen recording as compromised — revoke it and mint a replacement.
If you accidentally publish an API key (e.g. in a GitHub commit), assume it's been scraped. Revoke it from the dashboard and create a new one before doing anything else.