MiniMax returned an authentication error:
Error: Invalid API key
Here is how to fix it.
Fix 1: Verify API key
# Check if key is set
echo $MINIMAX_API_KEY
# Test the key
curl https://api.minimax.chat/v1/models \
-H "Authorization: Bearer $MINIMAX_API_KEY"
Fix 2: Generate new key
- Go to platform.minimax.chat
- Navigate to API Keys
- Create a new key
- Copy and save it
export MINIMAX_API_KEY="your-new-key"
Fix 3: Check key format
MiniMax keys have a specific format:
# Correct format
api_key = "your-group-id:your-api-key"
# Not just the API key
Fix 4: Check account status
# Check account balance
curl https://api.minimax.chat/v1/usage \
-H "Authorization: Bearer $MINIMAX_API_KEY"
Add credit at platform.minimax.chat if needed.
Fix 5: Verify endpoint
# Correct endpoint
client = openai.OpenAI(
base_url="https://api.minimax.chat/v1",
api_key="your-group-id:your-api-key"
)
Fix 6: Check permissions
Some keys have restricted access:
# Test with full permissions
curl https://api.minimax.chat/v1/chat/completions \
-H "Authorization: Bearer $MINIMAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"abab6.5-chat","messages":[{"role":"user","content":"test"}]}'
Still not working?
- Regenerate key β Create fresh API key
- Check email β Account verification may be required
- Contact support β platform.minimax.chat/support
- Use OpenRouter β Alternative access method
FAQ
How do I get a MiniMax API key?
Go to platform.minimax.chat, create an account, navigate to API Keys, and create a new key. MiniMax keys have a specific format: group-id:api-key.
Why is my API key not working?
MiniMax keys require both a group ID and API key separated by a colon. Check that you have the full key in the correct format. Also verify your account has credit and the key has not expired.
Can I use MiniMax API for free?
MiniMax offers a free tier with limited requests. For higher usage, you need to add credit to your account. See our AI API Pricing guide for details.
Related: MiniMax M3 Complete Guide Β· Best Chinese AI Models 2026 Β· AI API Pricing Compared 2026 Β· OpenRouter Complete Guide