Get an 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 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 “Verify” button, and click the “Enable OpenAI API Key” button in the pop-up window to complete verification.
- In the Models section, 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 OpenAI Compatible to connect to the MiniMax API via the OpenAI-compatible standard.
- In Base URL, enter “https://api.minimax.io/v1” to set the MiniMax service endpoint.
- In OpenAI Compatible API Key, enter the API key from the MiniMax Developer Platform.
- In Model ID, enter “MiniMax-M2” to specify the model.
- 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 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.
Recommended Reading
MiniMax-M2 Function Calling Guide
AI models can call external functions to extend their capabilities.
Text Generation
Supports text generation via compatible Anthropic API and OpenAI API.
Compatible OpenAI API
Use OpenAI SDK with MiniMax models
Compatible Anthropic API
Use Anthropic SDK with MiniMax models