MiniMax M2.7 API: price, context and code
Updated 2026-10-18 · MiniMax's coding and agent model at MiniMax's own price, through OpenAI- and Anthropic-compatible APIs, with code samples.
Connection details
- Base URL (OpenAI compatible)
- https://api.aifans.fan/v1
- Base URL (Anthropic compatible)
- https://api.aifans.fan
- API key
- Create one in the console; it starts with sk- (no account yet? sign up)
- Recommended models
- deepseek-v4.1-flash, deepseek-v4-pro (all models and prices)
MiniMax M2.7 is MiniMax's model for coding and agent workflows, with tool calls. AIFans API serves it through OpenAI- and Anthropic-compatible endpoints: point your tool at our base URL and use minimax-m2.7 as the model name.
Price
| USD per 1M tokens | Maker's own price | Here | Saving |
|---|---|---|---|
| Input | $0.3 | $0.2984 | about the same |
| Cached input | $0.06 | $0.0596 | about the same |
| Output | $1.2 | $1.1939 | about the same |
- The same price per token as MiniMax charges itself — we do not mark it up, and there is no subscription, no minimum spend and no monthly fee. Failed calls are never billed.
- Thinking is billed as output tokens, so leave max_tokens room (1000 or more).
- Online top-ups carry a payment processing fee of 5.5% (minimum $0.8), added at checkout and shown before you pay; it is not part of your credit.
What it can do
- A context window of about 200K tokens.
- Answers of up to 128K tokens.
- Tool calls, for agents that search, run code or call your own functions.
- Text in, text out.
Why call it here instead of direct
- One account and one key for M2.7 and every other model on the models page: switch models by changing one string, with no second sign-up, no second balance and no second invoice.
- Both API shapes: the OpenAI Chat Completions API and the Anthropic Messages API, so Claude Code and the OpenAI SDKs both work against the same key.
- Every call is itemised in the console with its tokens and price, and each key can carry a daily, monthly and total spending cap.
- Servers in Singapore, close to Southeast Asia, India and East Asia.
Call it with the OpenAI SDK
# pip install openai
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.aifans.fan/v1")
resp = client.chat.completions.create(
model="minimax-m2.7",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=1000,
)
print(resp.choices[0].message.content)Use it in Claude Code
Put this in ~/.claude/settings.json; the Claude Code guide has the details.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.aifans.fan",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "minimax-m2.7",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "minimax-m2.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax-m2.7",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-m2.7",
"CLAUDE_CODE_SUBAGENT_MODEL": "minimax-m2.7"
}
}