Install OpenCode
- Use
curlto install the OpenCode
- Use
npmto install the OpenCode
Configure MiniMax API
- Edit or create the OpenCode configuration file located at
~/.config/opencode/opencode.json. In this file, add or update the env field as shown below.
- The
baseURLshould be set based on your location: for international users, usehttps://api.minimax.io/anthropic/v1; for users in China, usehttps://api.minimaxi.com/anthropic/v1. - Set
<MINIMAX_API_KEY>to the API key obtained from the MiniMax Developer Platform (For users in China, visit MiniMax Developer Platform).
iii. Enter the provider ID as “minimax”:
iv. Enter your MiniMax API key when prompted:
- Navigate to your project and start interactive session
- Enter
/models, select the “MiniMax-M2.1” model and use it in OpenCode
