The official MiniMax documentation provides the login steps for selecting MiniMax-M3.1-Flash in OpenCode and the manual opencode.json configuration; the example sets the client context to 524288 tokens while stating that the model itself supports up to 1M tokens.
Suitable tasks: Using MiniMax M-series models for terminal coding tasks in OpenCode.
Unsuitable tasks: Non-OpenCode clients; the documentation provides no generic API request example and no parameters for preserving thinking or automatic compaction in OpenCode.
Applicable model version: MiniMax-M3.1-Flash.
Applicable client, Agent, or API: OpenCode (the SST open-source terminal coding Agent); the minimax-coding-plan provider in MiniMax M Plan.
Recommended reasoning tier and parameters: Not specified. Do not directly migrate reasoning settings from other clients to OpenCode.
Install and log in to OpenCode first:
curl -fsSL https://opencode.ai/install | bash
# or
npm i -g opencode-ai
opencode auth loginDuring login, search for and select MiniMax Token Plan (minimax.io) in OpenCode, then enter the Subscription Key. After starting opencode, select MiniMax-M3.1-Flash from the model list.
If the model does not appear in the list, edit ~/.config/opencode/opencode.json and add the following configuration:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"minimax-coding-plan": {
"models": {
"MiniMax-M3.1-Flash": {
"name": "MiniMax-M3.1-Flash",
"limit": { "context": 524288 }
}
}
}
}
}When configuring through a tool such as CC Switch, make sure the protocol and Base URL match. The official Anthropic-compatible configuration is shown below; this adapter appends /messages to the Base URL, so retain /anthropic/v1:
{
"provider": {
"minimax-coding-plan": {
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.minimax.io/anthropic/v1"
},
"models": {
"MiniMax-M3.1-Flash": {
"name": "MiniMax-M3.1-Flash",
"limit": { "context": 524288 }
}
}
}
}
}Install OpenCode and run opencode auth login.
Select MiniMax Token Plan (minimax.io) and enter the Subscription Key.
Start OpenCode and select MiniMax-M3.1-Flash.
If the model is not in the list, merge the provider and model configuration above into ~/.config/opencode/opencode.json, then run OpenCode again.
If using CC Switch, check that the protocol is an Anthropic-compatible implementation, the npm adapter is @ai-sdk/anthropic, and the Base URL is https://api.minimax.io/anthropic/v1.
The official documentation also provides a one-click installation wizard:
npx -y mmx-cli@latest agent setupSelect OpenCode in the wizard; the documentation says that the wizard installs the official npm package, verifies its version, and sets MiniMax as the default model. After it finishes, run opencode. This article does not perform the installation or write to the configuration.
The OpenCode page lists the model as MiniMax-M3.1-Flash and the provider as minimax-coding-plan.
The manual configuration file is ~/.config/opencode/opencode.json; the client context limit in the model configuration is 524288 tokens.
The page says that this example uses a 512K client context to balance cost and usability, while the model itself supports up to 1M context.
The Anthropic-compatible configuration uses @ai-sdk/anthropic and https://api.minimax.io/anthropic/v1; the adapter appends /messages.
The page provides no automatic compaction threshold, history-message retention rules, thinking-content retention format, or independent validation data for OpenCode.
524288 is the client context setting in the documentation example and should not be described as the model's maximum context; the page gives the model limit as 1M.
The page provides no validation steps or version number for how the current OpenCode version actually handles the 1M limit; confirm this in the target version before using 1M.
The documentation does not disclose reasoning tiers, a thinking toggle, thinking summaries, or a compaction threshold for OpenCode. Do not infer OpenCode behavior from settings for other Agents.
Subscription Key, account eligibility, and M Plan availability depend on the MiniMax account; this article contains no key and does not actually log in or install anything.
The page does not specify the publication date or the OpenCode/MiniMax versions; record the actual versions when reproducing the setup.
In an isolated environment, follow the steps above without running unreviewed installation scripts. After starting the client, confirm that the exact model name in the model list is MiniMax-M3.1-Flash, check the provider, adapter, Base URL, and context: 524288 in ~/.config/opencode/opencode.json, then send a short coding task containing no sensitive information to verify that the request succeeds. If using CC Switch, first check the protocol and Base URL it generates to avoid appending /anthropic/v1 twice.
MiniMax M3.1 Flash