﻿# Claude Code Configuration

**Pay-as-you-go MiMo API** and **Token Plan** both support Claude Code. Refer to this guide for configuration and usage.

## Prerequisites

### Obtain Credentials 

Supports two usage methods, but the corresponding credential acquisition methods are different:

<table>
<colgroup>
<col />
<col style="width: 191px" />
<col style="width: 700px" />
</colgroup>
<thead>
<tr>
<th>Usage Method</th>
<th>Description</th>
<th>Acquisition Method (BASE_URL and API Key below are examples)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Pay-as-you-go MiMo API</td>
<td>Charged based on actual usage, suitable for light use</td>
<td><ul><li>BASE_URL<ul><li>OpenAI Compatibility Protocol: `https://api.xiaomimimo.com/v1`</li><li>Anthropic Compatibility Protocol: `https://api.xiaomimimo.com/anthropic`</li></ul></li><li>API Key<ul><li>Format: `sk-xxxxx`</li></ul></li></ul><br />Go to [API Keys](https://platform.xiaomimimo.com/#/console/api-keys) to create an API Key</td>
</tr>
<tr>
<td>Token Plan</td>
<td>Fixed subscription fee, with limited calls based on the package</td>
<td><ul><li>BASE_URL<ul><li>OpenAI Compatibility Protocol: `https://token-plan-cn.xiaomimimo.com/v1`</li><li>Anthropic Compatibility Protocol: `https://token-plan-cn.xiaomimimo.com/anthropic`</li></ul></li><li>API Key<ul><li>Format: `tp-xxxxx`</li></ul></li></ul><br />After successful subscription, go to [Subscription](https://platform.xiaomimimo.com/#/console/plan-manage) to obtain the exclusive Base URL and API Key</td>
</tr>
</tbody>
</table>

## Use Claude Code CLI

### Install Claude Code CLI

Claude Code requires Node.js 18 or later.

- Linux/macOS: No additional setup needed, the default environment is sufficient.

- Windows: Install [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) or [Git for Windows](https://git-scm.com/install/windows), then run the command below in WSL or Git Bash.

**Installation command:**

```bash
npm install -g @anthropic-ai/claude-code
```

**Verify the installation (a version number output indicates success):**

```bash
claude --version
```

<div className='mdx-highlight'>

Do not launch Claude Code immediately after installation. Complete the configuration below first.

</div>

### Configure Basic Settings

<div className='mdx-highlight'>

Before configuring, make sure to clear the following Anthropic official environment variables to avoid API conflicts: `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL`

</div>

**1.**  **Create/edit** `settings.json`

> If the `.claude` directory does not exist, you can create it manually.

- macOS/Linux: `~/.claude/settings.json`

- Windows: `User directory\.claude\settings.json`

Please replace `BASE_URL` (Anthropic Compatibility Protocol) and `MIMO_API_KEY` as needed.

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "BASE_URL",
    "ANTHROPIC_AUTH_TOKEN": "MIMO_API_KEY",
    "ANTHROPIC_MODEL": "mimo-v2.5-pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "mimo-v2.5-pro",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "mimo-v2.5-pro",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "mimo-v2.5-pro"
  }
}
```

**2.**  **Create/edit** `.claude.json`

- macOS/Linux: `~/.claude.json`

- Windows: `User directory\.claude.json`

   ```json
   {
     "hasCompletedOnboarding": true
   }
   ```

**3.**  **Apply the configuration**

After completing the configuration, **reopen the terminal window** for the changes to take effect.

### Use Claude Code CLI

Navigate to your project directory and run:

```bash
claude
```

On first launch, complete the following: select "**Trust This Folder**" to allow Claude Code to access project files. After startup, use the `/status` command to verify the current configuration and model status.

## Use the Claude Code IDE Plugin

Claude Code provides a VS Code IDE plugin. For configuration reference, see the official documentation [Use Claude Code in VS Code](https://code.claude.com/docs/en/vs-code#vs-code-extension-vs-claude-code-cli).

### Install Plugin

Search for and install the **Claude Code for VS Code** plugin from the VS Code Extensions marketplace.

![图片](https://platform.xiaomimimo.com/static/Cpd0bPIpdoHSNdxFu4Yc34W9n52.fdfd71b3.png)

### Configure the Model

Open VS Code settings, search for `Claude Code: Environment Variables`, and then manually configure it in `settings.json`:

```json
{
  "claudeCode.preferredLocation": "panel",
  "claudeCode.selectedModel": "mimo-v2.5-pro",
  "claudeCode.environmentVariables": [
    {
      "name": "ANTHROPIC_BASE_URL",
      "value": "BASE_URL"
    },
    {
      "name": "ANTHROPIC_AUTH_TOKEN",
      "value": "MIMO_API_KEY"
    },
    {
      "name": "ANTHROPIC_DEFAULT_SONNET_MODEL",
      "value": "mimo-v2.5-pro"
    },
    {
      "name": "ANTHROPIC_DEFAULT_OPUS_MODEL",
      "value": "mimo-v2.5-pro"
    },
    {
      "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL",
      "value": "mimo-v2.5-pro"
    }
  ]
}
```

<div className='mdx-highlight'>

If Claude Code CLI is already installed, the VS Code plugin will automatically reuse the CLI configuration. To configure independently, specify the environment variables in the plugin settings as shown above.

</div>

## FAQ

### Installation fails on Windows?

Ensure the following dependencies are installed:

- Node.js 18+

- Git for Windows

If you encounter permission issues with npm, try running the terminal as administrator, or use nvm to manage Node.js versions.
