Authentication
All API requests to ModelMax require authentication via an API key passed in the Authorization header.
API keys
Creating a key
- Sign in to the ModelMax Dashboard with your Google account.
- Navigate to Settings → API Keys.
- Click Create API Key and give it a descriptive name.
- Copy the key immediately — it won't be shown again.
Treat your API key like a password. Never commit it to version control or expose it in client-side code.
Using a key
Pass the key in the Authorization header as a Bearer token:
curl https://api.modelmax.io/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{ "model": "gemini-3-flash-preview", "messages": [{"role":"user","content":"hi"}] }'
If you're using the OpenAI SDK, set it as api_key:
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.modelmax.io/v1",
)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-api-key",
baseURL: "https://api.modelmax.io/v1",
});
Revoking a key
Delete a key from the Dashboard or via the management API:
curl -X DELETE https://api.modelmax.io/api/keys/{keyID} \
-H "Cookie: session=..."
Revoked keys are immediately rejected.
Environment variables
We recommend storing your key in an environment variable:
export MODELMAX_API_KEY="sk-your-api-key"
Then reference it in code:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MODELMAX_API_KEY"],
base_url="https://api.modelmax.io/v1",
)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MODELMAX_API_KEY,
baseURL: "https://api.modelmax.io/v1",
});
Error responses
| Status | Meaning |
|---|---|
401 Unauthorized | Missing or invalid API key |
402 Payment Required | Insufficient balance |
See Error handling for details.
