MiniMax API key setup

Published 2026-10-10 · Updated 2026-10-20

MiniMax issues two different kinds of credentials, and mixing them up is the number-one source of “invalid API key” errors:

Both work the same way in a request; the difference is where they’re created and what quota they draw from.

Setup

export MINIMAX_API_KEY="eyJhbGciOiJIUzI1NiIs..."

Base URL for the OpenAI-compatible API: https://api.minimax.io/v1. There’s also an Anthropic-compatible surface at https://api.minimax.io/anthropic.

Call it

curl https://api.minimax.io/v1/chat/completions \
  -H "Authorization: Bearer $MINIMAX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-M3",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["MINIMAX_API_KEY"],
    base_url="https://api.minimax.io/v1",
)

Gotchas

Error code 2049 in MiniMax responses means invalid API key, usually a truncated JWT or a key from the wrong console.