Claude Code + MiMo API Setup
Anthropic's Claude Code is a powerful AI coding agent in the terminal. It can be configured to use any OpenAI-compatible API β including MiMo. This guide walks you through setting up Claude Code to run on MiMo's models, giving you access to MiMo's coding benchmarks at a fraction of the cost of Claude's API.
Why Use MiMo with Claude Code?
- Cost: MiMo-V2-Flash at $0.50/$1.50 per M tokens vs Claude 3.5 Sonnet at $3/$15 β up to 6-10Γ cheaper
- Coding performance: MiMo-V2-Flash achieves 73.4% on SWE-Bench, higher than Claude 3.5 Sonnet (~46%)
- Same interface: Claude Code's terminal UI, /ask and /edit commands, and Git integration remain unchanged
Prerequisites
- Claude Code installed (see Anthropic's documentation)
- A MiMo API key from platform.xiaomimimo.com
Step 1: Set Environment Variable
Claude Code reads the ANTHROPIC_BASE_URL environment variable to determine the API endpoint:
export ANTHROPIC_BASE_URL="https://api.xiaomimimo.com/v1"
export ANTHROPIC_API_KEY="miMo-sk-your-key-here"
Add these to your .bashrc or .zshrc to make the change permanent:
echo 'export ANTHROPIC_BASE_URL="https://api.xiaomimimo.com/v1"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="miMo-sk-your-key-here"' >> ~/.zshrc
source ~/.zshrc
Step 2: Launch Claude Code
claude
Claude Code starts normally. All commands β /ask, /edit, /debug, /run β work the same way, but the underlying inference is powered by MiMo instead of Claude.
Step 3: Select the Right Model
By default, Claude Code requests claude-sonnet-4-20250514. The MiMo API maps this to MiMo-V2-Flash. You can override the model in your Claude Code config:
# In ~/.claude.json or project .claude.json
{
"model": "mimo-v2.5-pro",
"maxTokens": 8192
}
Recommended Model Configurations
| Use Case | Model | Cost per 100 sessions |
|---|---|---|
| Quick edits, simple questions | MiMo-V2-Flash | ~$2-5 |
| Complex refactoring, architecture | MiMo-V2.5-Pro | ~$5-15 |
| Full-modal (vision) tasks | MiMo-V2.5-Omni | ~$5-20 |
Cost Comparison
| Setup | Monthly Cost (500 sessions) |
|---|---|
| Claude Code + Claude 3.5 Sonnet | $100-200 |
| Claude Code + MiMo-V2-Flash | $10-25 |
| Claude Code + MiMo-V2.5-Pro | $25-75 |
| MiMo Code (native) | $5-20 |
Limitations
- MiMo API doesn't support Anthropic's extended thinking (sliding-window reasoning) β but in practice, MiMo's reasoning RL training produces comparable outputs without it.
- Vision/image inputs only on V2.5-Omni (not V2-Flash or V2.5-Pro)
- Some Claude-native features (like artifact rendering) may behave differently
Troubleshooting
- "Invalid API key": Verify your key at platform.xiaomimimo.com
- "Model not found": Check that you're using the correct model ID (
mimo-v2-flashormimo-v2.5-pro) - "Rate limited": Wait 30 seconds and retry; consider upgrading to a Token Plan
Next Steps
- Try MiMo Code β Xiaomi's own terminal coding agent for native MiMo integration
- Read the MiMo Code deep dive
- Explore the FAQ