Integrate MiniMax M3 Models into Claude Code for Enhanced AI Programming
Learn how to set up Anthropic’s Claude Code terminal agent to use MiniMax’s M3 models for AI programming—including step-by-step configuration...
Claude Code, an official terminal-native programming agent from Anthropic, now supports integration with MiniMax’s latest M series models, enabling developers to leverage advanced AI capabilities directly in their terminal workflows. This integration unlocks the power of MiniMax M3—known for its large 1 million-token context window—for tasks like code generation, debugging, and collaborative problem-solving.
To get started, install Claude Code by following the instructions in the official Claude Code documentation. Once installed, the key steps involve configuring the tool to connect to MiniMax’s API instead of Anthropic’s default services.
Before configuring MiniMax, it’s critical to clear any existing Anthropic-related environment variables to avoid conflicts. On MacOS or Linux, run the commands unset ANTHROPIC_AUTH_TOKEN and unset ANTHROPIC_BASE_URL. If these variables are permanently set in files like ~/.bashrc or ~/.zshrc, remove the corresponding lines to prevent them from being reloaded in new shell sessions.
For manual configuration (recommended), edit or create the Claude Code settings file: on MacOS/Linux, this is ~/.claude/settings.json, and on Windows, it’s located in your user directory under .claude/settings.json. Replace <MINIMAX_API_KEY> with your actual MiniMax API key, and set the context window to match MiniMax M3’s limit using the CLAUDE_CODE_AUTO_COMPACT_WINDOW parameter. The configuration should include setting all default models to MiniMax-M3:
{ "env": { "ANTHROPIC_BASE_URL": "https://api.minimaxi.com/anthropic", "ANTHROPIC_AUTH_TOKEN": "<MINIMAX_API_KEY>", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000", "ANTHROPIC_MODEL": "MiniMax-M3[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M3[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M3[1m]", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M3[1m]" } }Additionally, create or edit the .claude.json file (in your home directory on MacOS/Linux, or user directory on Windows) to add the hasCompletedOnboarding parameter:
{ "hasCompletedOnboarding": true }After configuration, navigate to your working directory and run the claude command in the terminal to start Claude Code. When prompted, select "Trust This Folder" to allow the agent access to files in your working directory—this is necessary for it to interact with your codebase.
If you want to enable network search capabilities, follow the tutorial linked in the MiniMax documentation to configure the Network Search MCP.
To confirm the setup is successful, use the slash commands /status and /model in the Claude Code terminal interface. The /status command should show ANTHROPIC_BASE_URL pointing to api.minimaxi.com/anthropic (or api.minimax.io/anthropic for international users), and /model should display MiniMax-M3 as the active model.
MiniMax M3 supports Claude Code’s Extended Thinking feature, which is enabled by default. To toggle this, use the /config command and adjust the "Thinking mode" setting, or use the keyboard shortcut Option+T (MacOS) or Alt+T (Windows/Linux).
Sources
- MiniMax Platform Documentation: Claude Code Integration Guide