This is a configuration record for easy reference in the future and to provide information for those who need it.
Claude Code can integrate with third-party APIs, and Xiaomi’s MiMo model is one of them. It supports two billing methods: pay-as-you-go and a Token Plan, with slightly different configuration processes.
Prerequisites
You need the following two items:
| Item | Description |
|---|---|
| BASE_URL | The Anthropic-compatible API address |
| API Key | The key used for authentication |
The addresses for the two billing methods are different:
Pay-as-you-go (billed based on actual usage, suitable for light usage):
- BASE_URL:
https://api.xiaomimimo.com/anthropic - API Key format:
sk-xxxxx - Go to the API Keys page to create your API Key
Token Plan (fixed subscription fee with limited calls per package):
- BASE_URL:
https://token-plan-cn.xiaomimimo.com/anthropic - API Key format:
tp-xxxxx - Obtain your API Key after successful subscription on the subscription management page
Install the Claude Code CLI
You need Node.js version 18 or higher.
For Linux/macOS, installation is straightforward. For Windows, you need to install WSL or Git for Windows first:
npm install -g @anthropic-ai/claude-code
Verify the installation by running:
claude --version
If a version number is displayed, the installation was successful.
Configure the CLI
After installation, don’t start the CLI yet; configure it first.
1) Clear old environment variables
If you previously configured the Anthropic official environment variables, remove them:
unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_BASE_URL
2) Create settings.json
The file location is:
- macOS/Linux:
~/.claude/settings.json - Windows:
User directory/.claude/settings.json
Replace BASE_URL and MIMO_API_KEY with your own values:
{
"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"
}
}
The MiMo model supports a 1M context. Add the [1m] suffix after the model ID, for example, mimo-v2.5-pro[1m]. After configuring, restart Claude Code and run the /context command to verify that the extended context is working.
3) Create .claude.json
The file location is:
- macOS/Linux:
~/.claude.json - Windows:
User directory/.claude.json
{
"hasCompletedOnboarding": true
}
4) Restart the terminal
Close the terminal window and reopen it to apply the new configurations.
Use the CLI
Navigate to the project directory and run:
claude
When you start it for the first time, you will be prompted to “Trust This Folder”; choose to trust it. After starting, use the /status command to check the configuration and model status.
Configure the VS Code plugin
If you use VS Code, you can install the Claude Code plugin.
Installation
Search for Claude Code for VS Code in the VS Code Extension Market and install it.
Configuration
Open VS Code settings, search for “Claude Code: Environment Variables”, and add the following to settings.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"
}
]
}
If the Claude Code CLI is already installed, the VS Code plugin will automatically use the CLI’s configurations. The separate configuration method described above is suitable for scenarios where you need to manage them separately.
Common Issues
Installation errors on Windows?
Make sure you have Node.js version 18 or higher and Git for Windows installed. If you encounter permission issues during npm installation, run the terminal as an administrator or use nvm to manage Node.js versions.
Summary
The configuration steps are simple:
- Obtain the BASE_URL and API Key.
- Install the Claude Code CLI.
- Configure
settings.jsonand.claude.json. - Restart the terminal to apply the changes.
The pay-as-you-go option is suitable for light usage, while the Token Plan is ideal for heavy users who want a monthly subscription. The configuration processes for both methods are the same; the only differences are the BASE_URL and API Key values.