Skip to main content

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. Api key

Platform API Key

  1. Visit the MiniMax Developer Platform
  2. Click the “Create new secret key” button and enter a project name to create a new API key.
  3. 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.
API-Key

Install Claude Code

Refer to the Claude Code documentation for installation.

Configure MiniMax API

  1. Edit or create the Claude Code configuration file located at ~/.claude/settings.json. In this file, add or update the env field as shown below. Set MINIMAX_API_KEY to the API key obtained from the MiniMax Developer Platform.
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<MINIMAX_API_KEY>",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
    "ANTHROPIC_MODEL": "MiniMax-M2",
    "ANTHROPIC_SMALL_FAST_MODEL": "MiniMax-M2",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2"
  }
}
  1. After completing the configuration, navigate to your working directory and run the claude command 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:
claude-trust
  1. You can now start using Claude Code for development.

Use M2 in Claude Code Extension for VS Code

  1. Install Claude Code Extension for VS Code
  1. After installation, click Settings
  1. Configure the model to MiniMax-M2
  • In Settings - Claude Code: Selected Model, enter MiniMax-M2
Or
  • Click Edit in settings.json, modify claude-code.selectedModel to MiniMax-M2 in the configuration file.
  1. 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.environmentVariables to following settings.
"claudeCode.environmentVariables": [
        {
            "name": "ANTHROPIC_BASE_URL",
            "value": "https://api.minimax.io/anthropic"
        },
        {
            "name": "ANTHROPIC_AUTH_TOKEN",
            "value": "<MINIMAX_API_KEY>"
        },
        {
            "name": "API_TIMEOUT_MS",
            "value": "3000000"
        },
        {
            "name": "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
            "value": "1"
        },
        {
            "name": "ANTHROPIC_MODEL",
            "value": "MiniMax-M2"
        },
        {
            "name": "ANTHROPIC_SMALL_FAST_MODEL",
            "value": "MiniMax-M2"
        },
        {
            "name": "ANTHROPIC_DEFAULT_SONNET_MODEL",
            "value": "MiniMax-M2"
        },
        {
            "name": "ANTHROPIC_DEFAULT_OPUS_MODEL",
            "value": "MiniMax-M2"
        },
        {
            "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL",
            "value": "MiniMax-M2"
        }
    ],

Use MiniMax-M2 in Cursor

Install Cursor

  1. Download and install Cursor from the Cursor website.
  2. Open Cursor, click the “Settings” button in the top-right corner to enter the settings page.
  3. Click the “Sign in” button to log in to your Cursor account.
cursor-install

Configure MiniMax API

  1. Click “Models” in the left sidebar to open the model configuration page.
  2. Expand the “API Keys” section and configure the API information:
  3. Paste the API key obtained from the MiniMax Developer Platform into the OpenAI API Key field.
  4. Click the button on the right side of the “OpenAI API Key” field.
cursor-configuration
  1. Click the “Enable OpenAI API Key” button in the pop-up window to complete verification.
cursor-verify
  1. In the Models section, click the “View All Models” button, and then click the “Add Custom Model” button.
  1. Enter the model name “MiniMax-M2”, then click the “Add” button.
  1. Enable the newly added “MiniMax-M2” model.
  2. Select the “MiniMax-M2” model in the chat panel and start using “MiniMax-M2” for development.

Use MiniMax-M2 in Cline

Install Cline

  1. Open VS Code, click the Extensions icon in the left activity bar, and search for “Cline”.
  2. Click the “Install” button to add the extension. After installation, you may need to restart VS Code.
  1. Once installed, the Cline icon will appear in the left activity bar.
If you already have Cline installed, please upgrade to version 3.34.1 or higher, and restart both the extension and VS code to ensure proper functionality.

Configure MiniMax API

  1. Click Use your own API key to open Cline’s configuration page.
  2. Under API Provider, select MiniMax.
  3. In MiniMax Entrypoint, select “api.minimax.io” to set the MiniMax service endpoint.
  4. In MiniMax API Key, enter the API key from the MiniMax Developer Platform.
  5. Click Let’s go!, then click Done in the top-right corner to save the configuration.
  1. 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

  1. Open VS Code, click the Extensions icon in the left activity bar, and search for “Roo Code”.
  2. Click the “Install” button to add the extension. After installation, you may need to restart VS Code.

Configure MiniMax API

  1. Click Settings to go to the configuration page.
  1. Under API Provider, select MiniMax.
  2. In MiniMax Entrypoint, select “api.minimax.io”.
  3. In MiniMax API Key, enter the API key from the MiniMax Developer Platform.
  4. Click Save and then Done in the top-right corner to save the configuration.
  1. Start using “MiniMax-M2” for development.

Use MiniMax-M2 in Grok CLI

Install Grok CLI

  1. Use npm to install the Grok CLI globally:
npm install -g @vibe-kit/grok-cli

Configure MiniMax API

  1. 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.
export GROK_BASE_URL="https://api.minimax.io/v1"  
export GROK_API_KEY="<MINIMAX_API_KEY>"
  1. Start the Grok CLI with a specified model: MiniMax-M2
grok --model MiniMax-M2

Use MiniMax-M2 in Codex CLI

To facilitate integrating models with the Codex CLI, it is recommended to use the codex-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

npm i -g @openai/codex

Configure MiniMax API

  1. Add the following configuration to the .codex/config.toml file:
[model_providers.minimax]
name = "MiniMax Chat Completions API"
base_url = "https://api.minimax.io/v1"
env_key = "MINIMAX_API_KEY"
wire_api = "chat"
requires_openai_auth = false
request_max_retries = 4
stream_max_retries = 10
stream_idle_timeout_ms = 300000

[profiles.m2]
model = "codex-MiniMax-M2"
model_provider = "minimax"
  1. 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.
export MINIMAX_API_KEY="<MINIMAX_API_KEY>"
  1. Start the Codex CLI with the specified profile.
codex --profile m2

Use MiniMax-M2 in Droid

Install Droid

For Mac/Linux Users:
curl -fsSL https://app.factory.ai/cli | sh
For Windows Users:
irm https://app.factory.ai/cli/windows | iex
For more information, please refer to the Droid documentation.

Configure MiniMax API

  1. Use following command to edit the configuration file located at ~/.factory/config.json. Set MINIMAX_API_KEY to the API key obtained from the MiniMax Developer Platform.
Tips:
  • Config ~/.factory/config.json, NOT ~/.factory/settings.json
  • Clear the ANTHROPIC_AUTH_TOKEN environment variable, otherwise it will override the API key in .factory/config.json and cause errors
cat ~/.factory/config.json
{
    "custom_models": [
        {
            "model_display_name": "MiniMax-M2",
            "model": "MiniMax-M2",
            "base_url": "https://api.minimax.io/anthropic",
            "api_key": "<MINIMAX_API_KEY>",
            "provider": "anthropic",
            "max_tokens": 16384
        }
    ]
}
  1. Navigate to your project and start interactive session
cd /path/to/your/project
droid
  1. Enter /model, select the “MiniMax-M2” model and use it in Droid.

Use MiniMax-M2 in OpenCode

Install OpenCode

  • Use curl to install the OpenCode
curl -fsSL https://opencode.ai/install | bash
  • Use npm to install the OpenCode
npm i -g opencode-ai
For more information, please refer to the OpenCode website

Configure MiniMax API

  1. 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. Set MINIMAX_API_KEY to the API key obtained from the MiniMax Developer Platform.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "minimax": {
      "npm": "@ai-sdk/anthropic",
      "options": {
        "baseURL": "https://api.minimax.io/anthropic/v1",
        "apiKey": "<MINIMAX_API_KEY> (Optional)"
      },
      "models": {
        "MiniMax-M2": {
          "name": "MiniMax-M2"
        }
      }
    }
  }
}
Alternative Authentication Method: If you prefer not to add the API key directly to the configuration file, you can authenticate using the interactive login command. Follow these steps: i. Run the authentication command:
opencode auth login
ii. When prompted, select provider “Other”: iii. Enter the provider ID as “minimax”: iv. Enter your MiniMax API key when prompted:
  1. Navigate to your project and start interactive session
cd /path/to/your/project

opencode
  1. Enter /models, select the “MiniMax-M2” model and use it in OpenCode

Troubleshooting

API Error

API Error: Cannot read properties of undefined (reading 'map')
Please verify the following:
  1. Ensure the API host is set correctly to: https://api.minimax.io
  2. Confirm that you have replaced <MINIMAX_API_KEY> with your API key from MiniMax Developer Platform..
  3. If you are using Claude Code or Droid, clear the environment variable: ANTHROPIC_AUTH_TOKEN
  4. 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
  5. Reached the rate limit, please wait and try again later.
If the issue persists, feel free to contact us at: api@minimax.io