Background texture

Authentication

All API requests to ModelMax require authentication via an API key passed in the Authorization header.

API keys

Creating a key

  1. Sign in to the ModelMax Dashboard with your Google account.
  2. Navigate to Settings → API Keys.
  3. Click Create API Key and give it a descriptive name.
  4. 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

StatusMeaning
401 UnauthorizedMissing or invalid API key
402 Payment RequiredInsufficient balance

See Error handling for details.