Get an API Key
Coding Plan API Key
If you are subscribed to a coding plan, please use your coding plan API key to access your benefits. Visit the Account/Coding Plan page, get your Coding Plan API Key for use in coding tools.
Platform API Key
- Visit the MiniMax Developer Platform
- Click the “Create new secret key” button and enter a project name to create a new API key.
- After creation, the system will display the API key. Be sure to copy and save it securely. The key is shown only once and cannot be viewed again.
Use MiniMax-M2 in Claude Code (Recommended)
Install Claude Code
Refer to the Claude Code documentation for installation.Configure MiniMax API
- Edit or create the Claude Code configuration file located at
~/.claude/settings.json. In this file, add or update theenvfield as shown below. SetMINIMAX_API_KEYto the API key obtained from the MiniMax Developer Platform.
- After completing the configuration, navigate to your working directory and run the
claudecommand in the terminal to start using Claude Code. After startup, select Trust This Folder to allow it to access the files in your folder as shown below:
- You can now start using Claude Code for development.
Use M2 in Claude Code Extension for VS Code
- Install Claude Code Extension for VS Code
- After installation, click Settings
- Configure the model to
MiniMax-M2
- In Settings -
Claude Code: Selected Model, enterMiniMax-M2
Or
- Click
Edit in settings.json, modifyclaude-code.selectedModeltoMiniMax-M2in the configuration file.
- Configure the environment variables
- If Claude Code is already installed, please refer to the Claude Code Configuration to configure the environment variables.
- If Claude Code is not installed, click
Edit in settings.json
- Then modify
claude-code.environmentVariablesto following settings.
Use MiniMax-M2 in Cursor
Install Cursor
- Download and install Cursor from the Cursor website.
- Open Cursor, click the “Settings” button in the top-right corner to enter the settings page.
- Click the “Sign in” button to log in to your Cursor account.
Configure MiniMax API
- Click “Models” in the left sidebar to open the model configuration page.
- Expand the “API Keys” section and configure the API information:
- Enable “Override OpenAI Base URL”;
- Enter the MiniMax base URL: https://api.minimax.io/v1
- Paste the API key obtained from the MiniMax Developer Platform into the OpenAI API Key field.
- Click the button on the right side of the “OpenAI API Key” field.

- Click the “Enable OpenAI API Key” button in the pop-up window to complete verification.
- In the Models section, click the “View All Models” button, and then click the “Add Custom Model” button.
- Enter the model name “MiniMax-M2”, then click the “Add” button.
- Enable the newly added “MiniMax-M2” model.
- Select the “MiniMax-M2” model in the chat panel and start using “MiniMax-M2” for development.
Use MiniMax-M2 in Cline
Install Cline
- Open VS Code, click the Extensions icon in the left activity bar, and search for “Cline”.
- Click the “Install” button to add the extension. After installation, you may need to restart VS Code.
- Once installed, the Cline icon will appear in the left activity bar.
Configure MiniMax API
- Click Use your own API key to open Cline’s configuration page.
- Under API Provider, select MiniMax.
- In MiniMax Entrypoint, select “api.minimax.io” to set the MiniMax service endpoint.
- In MiniMax API Key, enter the API key from the MiniMax Developer Platform.
- Click Let’s go!, then click Done in the top-right corner to save the configuration.
- Enable the “Edit” option box in “Auto-approve” section and start using “MiniMax-M2” for development.
Use MiniMax-M2 in Roo Code
Install Roo Code
- Open VS Code, click the Extensions icon in the left activity bar, and search for “Roo Code”.
- Click the “Install” button to add the extension. After installation, you may need to restart VS Code.
Configure MiniMax API
- Click Settings to go to the configuration page.
- Under API Provider, select MiniMax.
- In MiniMax Entrypoint, select “api.minimax.io”.
- In MiniMax API Key, enter the API key from the MiniMax Developer Platform.
- Click Save and then Done in the top-right corner to save the configuration.
- Start using “MiniMax-M2” for development.
Use MiniMax-M2 in Grok CLI
Install Grok CLI
- Use npm to install the Grok CLI globally:
Configure MiniMax API
- Set the base URL and API key using environment variables. Use the API key obtained from the MiniMax Developer Platform as the value for
MINIMAX_API_KEY.
- Start the Grok CLI with a specified model: MiniMax-M2
Use MiniMax-M2 in Codex CLI
To facilitate integrating models with the Codex CLI, it is recommended to use thecodex-MiniMax-M2 model. While models can interact with files using tools like Bash, this approach is not considered optimal for Agent workflows. For better Agent-based practices, we suggest using platforms such as Claude Code or Cursor.
Install codex
Configure MiniMax API
- Add the following configuration to the
.codex/config.tomlfile:
- Set the API key using environment variables in the current terminal session for security reasons. Use the API key obtained from the MiniMax Developer Platform as the value for
MINIMAX_API_KEY.
- Start the Codex CLI with the specified profile.
Use MiniMax-M2 in Droid
Install Droid
For Mac/Linux Users:Configure MiniMax API
- Use following command to edit the configuration file located at
~/.factory/config.json. SetMINIMAX_API_KEYto the API key obtained from the MiniMax Developer Platform.
Tips:
- Config
~/.factory/config.json, NOT~/.factory/settings.json - Clear the
ANTHROPIC_AUTH_TOKENenvironment variable, otherwise it will override the API key in.factory/config.jsonand cause errors
- Navigate to your project and start interactive session
- Enter
/model, select the “MiniMax-M2” model and use it in Droid.
Use MiniMax-M2 in OpenCode
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. SetMINIMAX_API_KEYto the API key obtained from the 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” model and use it in OpenCode
Troubleshooting
API Error
- Ensure the API host is set correctly to:
https://api.minimax.io - Confirm that you have replaced
<MINIMAX_API_KEY>with your API key from MiniMax Developer Platform.. - If you are using Claude Code or Droid, clear the environment variable:
ANTHROPIC_AUTH_TOKEN - If you are using Claude Code in VS Code or Cursor, please make sure to set the model to
MiniMax-M2. For more details, see: Using M2 in Claude Code for VS Code - Reached the rate limit, please wait and try again later.
Recommended Reading
M2 Tool Use & Interleaved Thinking
AI models can call external functions to extend their capabilities.
Text Generation
Supports text generation via compatible Anthropic API and OpenAI API.
Compatible Anthropic API (Recommended)
Use Anthropic SDK with MiniMax models
Compatible OpenAI API
Use OpenAI SDK with MiniMax models