Run Claude Code on MiniMax-M3 and MiniMax-M2.7
Keep the Claude Code workflow, pay MiniMax prices: three environment variables connect Claude Code to MiniMax through an Anthropic-compatible endpoint.
Why run Claude Code on MiniMax
Claude Code talks to any server that speaks the Anthropic Messages API. YiduoChan exposes MiniMax-M3 and MiniMax-M2.7 through exactly that protocol, so you keep the Claude Code workflow, agents and tools while paying MiniMax prices: MiniMax-M2.7 costs $0.30 per million input tokens and $1.20 per million output tokens, and MiniMax-M3 gives you a 1,048,576-token context for whole-repository work at the same rate in the ≤512K tier.
Setup with environment variables
# 1. Get an API key at https://yiduochan.com/register
# 2. Point Claude Code at the Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL=https://yiduochan.com
export ANTHROPIC_AUTH_TOKEN=YIDUOCHAN_API_KEY
export ANTHROPIC_MODEL=MiniMax-M2.7
export ANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7
export ANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M3
export ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7-highspeed
# 3. Start Claude Code as usual
claude
Setup with settings.json
Put the same values in ~/.claude/settings.json (or the project's .claude/settings.json) for a persistent configuration:
{
"env": {
"ANTHROPIC_BASE_URL": "https://yiduochan.com",
"ANTHROPIC_AUTH_TOKEN": "YIDUOCHAN_API_KEY",
"ANTHROPIC_MODEL": "MiniMax-M3",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2.7",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M3",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2.7-highspeed"
}
}
Which model to choose
| Model | Best for | Price per 1M tokens |
|---|---|---|
| MiniMax-M3 | Large repositories, long sessions, deep reasoning; 1M context | $0.30 in / $1.20 out (≤512K), $0.60 / $2.40 above 512K |
| MiniMax-M2.7 | Everyday coding, edits, refactors | $0.30 in / $1.20 out |
| MiniMax-M2.7-highspeed | Fast helper model for file summaries and quick tool calls | $0.60 in / $2.40 out |
Prompt caching is automatic: repeated context is billed at the cache-read rate of $0.06 per million tokens, which matters for Claude Code's long, repetitive system prompts.
Two caveats. The ANTHROPIC_DEFAULT_*_MODEL variables map Claude Code's built-in sonnet, opus and haiku aliases to MiniMax models; the older ANTHROPIC_SMALL_FAST_MODEL is deprecated. The /v1/messages/count_tokens endpoint is not available on this relay yet, so Claude Code estimates context usage locally; regular requests are unaffected.
Verify the connection
curl https://yiduochan.com/v1/messages \
-H "x-api-key: $YIDUOCHAN_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "MiniMax-M2.7", "max_tokens": 64, "messages": [{"role": "user", "content": "Say hello"}]}'
Getting a key without signing up
Creating an account and topping up is the usual route, and it is the one most people want.
It is not the only one. The same models are exposed on an
agent-native endpoint that speaks the
x402 protocol: an unpaid request comes back
402 Payment Required with the terms in a header, and a request carrying a signed USDC
authorization comes back with the completion, an API key and the remaining balance. No account,
no email, no card.
You can read the terms without spending anything — the challenge is a plain JSON document,
base64 in the PAYMENT-REQUIRED header:
curl -i -X POST https://yiduochan.com/api/x402/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "MiniMax-M2.7", "messages": [{"role": "user", "content": "hi"}]}'
It settles on Base and Arbitrum. This is the path to use when the caller is a program that has to decide at runtime which tools it needs, rather than a person who can go fill in a signup form. Details and the prepaid variant are on the agent guide.
Other Anthropic-compatible tools
- Cline / Roo Code: choose the Anthropic provider, set the base URL to
https://yiduochan.comand enter the model name manually. - Anthropic SDKs: construct the client with
base_url="https://yiduochan.com"and your key. - OpenAI-compatible tools such as Cursor or Continue use
https://yiduochan.com/v1instead; see the MiniMax-M2.7 guide.
FAQ
Does Claude Code work with MiniMax models?
Yes. Set ANTHROPIC_BASE_URL to https://yiduochan.com, ANTHROPIC_AUTH_TOKEN to your key and ANTHROPIC_MODEL to MiniMax-M2.7 or MiniMax-M3; Claude Code then sends its Anthropic Messages requests to MiniMax through this relay.
Which MiniMax model is best for Claude Code?
MiniMax-M2.7 is the everyday choice; switch to MiniMax-M3 when you need the 1M context for large codebases. Use MiniMax-M2.7-highspeed as the small fast model.
How much does Claude Code on MiniMax cost?
You pay per token at MiniMax rates: $0.30 per million input and $1.20 per million output tokens for MiniMax-M2.7, with cache reads at $0.06. There is no subscription.
Do tools and agents still work?
Yes. The relay forwards tool definitions, tool results and streaming through the Anthropic Messages format, so Claude Code's file edits, shell commands and sub-agents behave as usual.