> ## Documentation Index
> Fetch the complete documentation index at: https://platform.minimax.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

> Use the latest MiniMax M-series models for AI programming in Claude Code.

<div style={{background:"#fffbeb",borderLeft:"4px solid #d97706",padding:"12px 16px",borderRadius:"6px",margin:"16px 0"}}>[**Claude Code**](https://github.com/anthropics/claude-code) is Anthropic's official terminal-native coding agent powered by Claude.</div>

## Install Claude Code

You can skip this section when using the one-click setup wizard below. If it cannot find the `claude` command, it offers to run the official Claude Code installer.

Refer to the [Claude Code documentation](https://code.claude.com/docs/en/setup) for installation.

## Configure MiniMax API

<Warning>
  Before configuring, clear these environment variables. They take priority over the settings file and override the MiniMax configuration:

  ```bash theme={null}
  unset ANTHROPIC_AUTH_TOKEN
  unset ANTHROPIC_BASE_URL
  ```

  If `~/.bashrc` or `~/.zshrc` exports them, remove those lines too, or new shells will load them again.
</Warning>

<Tabs sync={false}>
  <Tab title="Option 1: One-click setup wizard">
    Run:

    ```bash theme={null}
    npx -y mmx-cli@latest agent setup
    ```

    Select **Claude Code**. If it is missing, keep Claude Code selected in the second multi-select. The wizard runs the official installer, checks `claude --version`, updates `~/.claude/settings.json`, and adds the MiniMax model list.

    See [MiniMax CLI](/docs/m-plan/minimax-cli) for command options and backup behavior.
  </Tab>

  <Tab title="Option 2: Edit the settings file">
    1. Edit or create `~/.claude/settings.json` and replace `<MINIMAX_API_KEY>` with your [Subscription Key](https://platform.minimax.io/console/plan):

       ```json theme={null}
       {
         "env": {
           "ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
           "ANTHROPIC_AUTH_TOKEN": "<MINIMAX_API_KEY>",
           "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "524288",
           "ANTHROPIC_MODEL": "MiniMax-M3.1-Flash-Preview[1m]",
           "ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M3.1-Flash-Preview[1m]",
           "ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M3.1-Flash-Preview[1m]",
           "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M3.1-Flash-Preview[1m]"
         }
       }
       ```

    2. Go to your working directory, run `claude`, and select **Trust This Folder** to start.

    The manual example uses the recommended 512K auto-compaction window (`CLAUDE_CODE_AUTO_COMPACT_WINDOW=524288`). See the [512K guidance](/docs/m-plan/codex#context-window-512k).
  </Tab>

  <Tab title="Option 3: Use CC Switch">
    [CC Switch](https://github.com/farion1231/cc-switch) lets you switch Claude Code API providers.

    1. Install CC Switch: on macOS / Linux, run `brew tap farion1231/ccswitch && brew install --cask cc-switch`; on Windows, download it from [GitHub Releases](https://github.com/farion1231/cc-switch/releases).
    2. Open CC Switch, click **+**, select the MiniMax preset, and enter your [Subscription Key](https://platform.minimax.io/console/plan).
    3. Set all model names to `MiniMax-M3.1-Flash-Preview` and select **Declare 1M**.
    4. Add `"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "524288"` to the provider configuration JSON's `env`, then click **Add**.
    5. Return to the home screen and click **Enable**.
  </Tab>
</Tabs>

To add web search, see [Web Search MCP](/docs/m-plan/mcp-guide).

## Verify the Configuration

After starting `claude`, run the following slash commands inside the TUI to confirm Claude Code is using MiniMax instead of the default Claude provider:

```text theme={null}
/status
/model
```

* `/status` should show the `ANTHROPIC_BASE_URL` pointing to `api.minimax.io/anthropic`.
* `/model` should show the active model as `MiniMax-M3.1-Flash-Preview`.

<Tip>
  MiniMax-M3.1-Flash-Preview always enables thinking and cannot turn it off.
</Tip>
