OpenCode can call MiniMax through its OpenAI-compatible API. The important details are the current model ID, MiniMax-M3, and OpenCode’s current custom-provider format.
Install OpenCode and create a key
Follow the OpenCode Windows and WSL installation guide, then create an API key in the MiniMax Developer Platform.
In WSL, export the key in the terminal that will launch OpenCode:
export MINIMAX_API_KEY="YOUR_MINIMAX_API_KEY"
PowerShell uses this form for the current session:
$env:MINIMAX_API_KEY = "YOUR_MINIMAX_API_KEY"
Configure the provider
Open your opencode.json file and merge in this provider. Do not overwrite unrelated providers or permissions already in the file.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"minimax": {
"npm": "@ai-sdk/openai-compatible",
"name": "MiniMax",
"options": {
"baseURL": "https://api.minimax.io/v1",
"apiKey": "{env:MINIMAX_API_KEY}"
},
"models": {
"MiniMax-M3": {
"name": "MiniMax M3"
}
}
}
},
"model": "minimax/MiniMax-M3"
}
MiniMax M3 supports up to a 1-million-token context window and accepts native multimodal input. Availability and the usable context limit can depend on the API service and account.
Start OpenCode
Run OpenCode inside a project:
cd /path/to/project
opencode
The provider prefix in minimax/MiniMax-M3 must match the minimax key under provider. If you prefer to select the model interactively, start OpenCode and use /models.
Check the API directly
If OpenCode reports that it cannot find the model, ask MiniMax’s model endpoint what your key can access:
curl https://api.minimax.io/v1/models \
-H "Authorization: Bearer $MINIMAX_API_KEY"
Look for MiniMax-M3 in the response. An authentication error means the key was not exported in the shell that launched OpenCode or belongs to a different MiniMax service region.
MiniMax and OpenCode check
- Install a current OpenCode release
- Create and export a MiniMax API key
- Use https://api.minimax.io/v1 as the base URL
- Enter MiniMax-M3 with exact capitalization
- Start OpenCode and confirm the selected model
Older M2 models remain available, but M3 is the current choice for a new setup. Keeping the exact model ID in one provider block also makes future upgrades easy to review.
For Claude Code, use the direct MiniMax M3 setup.