Authentication
Pass one Model Gate API key in Anthropic- and OpenAI-compatible modes.
Authentication
Model Gate uses production API keys beginning with mg_live_. The same key works in both API modes; only the HTTP header changes.
Headers
| Endpoint | Authentication header | Additional headers |
|---|---|---|
POST /v1/messages | x-api-key: mg_live_... | anthropic-version: 2023-06-01 |
POST /v1/chat/completions | Authorization: Bearer mg_live_... | — |
POST /v1/web-search | Authorization: Bearer mg_live_... | — |
GET /v1/balance | Authorization: Bearer mg_live_... | — |
GET /v1/models | No authentication required | — |
Examples
Anthropic-compatible
curl https://api.model-gate.com/v1/messages \
-H "x-api-key: mg_live_..." \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{...}'
OpenAI-compatible
curl https://api.model-gate.com/v1/chat/completions \
-H "Authorization: Bearer mg_live_..." \
-H "content-type: application/json" \
-d '{...}'
Key management
For each key you can set a descriptive name, RPM and concurrency limits, spend limits, and allowed models. Freeze or delete a key when it is no longer required.
Keep your API key secure. The full value is shown only once when the key is created. Store it in an environment variable or secret manager and rotate it immediately if exposed.
Security recommendations
- Never commit keys to Git. - Store keys in .env files excluded from version control or in a secret manager. - Use a separate key for every project and environment. - Freeze a compromised key immediately and create a replacement.