MiniMax-AI/skills · critical · SystemExit

ERROR: MINIMAX_API_BASE is not set.

Error message

ERROR: MINIMAX_API_BASE is not set.

What it means

Raised at module import time: lines 28-30 read MINIMAX_API_BASE and immediately SystemExit if it is empty. Unlike the API-key check (which is lazy), this runs on import, so merely importing minimax_video without the env var kills the interpreter. The variable selects the regional endpoint (China mainland: https://api.minimaxi.com/v1, overseas: https://api.minimax.io/v1).

Source

Thrown at skills/gif-sticker-maker/scripts/minimax_video.py:30

  python minimax_video.py "Figurine laughing" --image laugh.png -o laugh.mp4 --duration 6

Env: MINIMAX_API_KEY (required)
"""

import os
import sys
import json
import time
import base64
import argparse
import requests

API_KEY = os.getenv("MINIMAX_API_KEY")
# China Mainland: https://api.minimaxi.com/v1
# Overseas:       https://api.minimax.io/v1
API_BASE = os.getenv("MINIMAX_API_BASE")
if not API_BASE:
    raise SystemExit("ERROR: MINIMAX_API_BASE is not set.")

I2V_MODELS = [
    "MiniMax-Hailuo-2.3",
    "MiniMax-Hailuo-2.3-Fast",
    "MiniMax-Hailuo-02",
    "I2V-01-Director",
    "I2V-01-live",
    "I2V-01",
]

T2V_MODELS = [
    "MiniMax-Hailuo-2.3",
    "MiniMax-Hailuo-02",
    "T2V-01-Director",
    "T2V-01",
]

View on GitHub (pinned to 60aaae52bb)

Solutions

  1. export MINIMAX_API_BASE='https://api.minimax.io/v1' (overseas) or 'https://api.minimaxi.com/v1' (China mainland).
  2. Persist it in your shell profile or a .env loaded by the runner.
  3. Verify: echo $MINIMAX_API_BASE

Example fix

# before
python minimax_video.py 'prompt' -o out.mp4   # SystemExit at import

# after
export MINIMAX_API_BASE='https://api.minimax.io/v1'
export MINIMAX_API_KEY='...'
python minimax_video.py 'prompt' -o out.mp4
Defensive patterns

Strategy: validation

Validate before calling

import os
base = os.getenv('MINIMAX_API_BASE')
if not base:
    raise EnvironmentError('Set MINIMAX_API_BASE (overseas: https://api.minimax.io/v1, CN: https://api.minimaxi.com/v1)')
if not base.rstrip('/').endswith('/v1'):
    raise EnvironmentError('MINIMAX_API_BASE must end with /v1')

Try / catch

try:
    import minimax_video
except SystemExit:
    raise RuntimeError('MINIMAX_API_BASE not configured; cannot load video module')

Prevention

When it happens

Trigger: Importing or running minimax_video.py when MINIMAX_API_BASE is unset or empty. The check executes before any function call, so even 'import minimax_video' triggers it.

Common situations: New shell without sourced env; CI runner missing the secret; typo (MINIMAX_API_BASE vs MINIMAX_BASE); forgetting the /v1 path suffix; using the wrong region endpoint for the account.

Related errors


AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13). Data as JSON: /api/errors/e7840cc7474942d4. Report an issue: GitHub.