# MiniMax API: model IDs, handling thinking content, image input and Claude Code
Source: https://ofox.ai/docs/develop/models/minimax
MiniMax's text models, including MiniMax M3, M2.7 and M2.7 HighSpeed. They are called through the OpenAI-compatible API and also support the Anthropic-native API, so they work in Claude Code. For MiniMax's video models, see [Hailuo (MiniMax)](https://ofox.ai/docs/develop/models/hailuo).
## Common tasks
- [Handle thinking content](#thinking) — Where the think tags at the start of the answer come from and how to remove them.
- [Use in Claude Code](#anthropic) — Call MiniMax through the Anthropic API.
- [Image input](#vision) — MiniMax M3 only.
- [Troubleshooting errors](#errors) — Unsupported thinking parameter, max_tokens too large, model not found.
## Models
For the full model list and live prices, see the [model page](https://ofox.ai/models?provider=minimax). The model ID prefix is `minimax/` and can be omitted; the official name `MiniMax-M3` returns 404.
**Common model IDs (copy them exactly)**
- MiniMax M3: `minimax/minimax-m3` — About 1.1M context; supports image input
- MiniMax M2.7: `minimax/minimax-m2.7` — 200K context; text only
- MiniMax M2.7 HighSpeed: `minimax/minimax-m2.7-highspeed` — 200K context; text only
These models are served by MiniMax (`minimax`) and support Chat Completions, Responses and the Anthropic-native API.
## Examples
**Python**
```python filename="minimax_basic.py"
import os
import re
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"])
resp = client.chat.completions.create(
model="minimax/minimax-m3",
messages=[{"role": "user", "content": "Explain idempotency in one sentence."}],
)
content = resp.choices[0].message.content
answer = re.sub(r".*?\s*", "", content, flags=re.S)
print(answer)
```
**cURL**
```bash filename="Terminal"
curl https://api.ofox.ai/v1/chat/completions \
-H "Authorization: Bearer $OFOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax/minimax-m3",
"messages": [{"role": "user", "content": "Explain idempotency in one sentence."}]
}'
```
## Thinking content
**Key point**:On the OpenAI-compatible API, thinking content is wrapped in think tags at the start of the answer. Strip it before showing the answer to users, or use the Anthropic API to get separate thinking blocks.
MiniMax models think by default. On the OpenAI-compatible API, `message.content` begins with thinking content wrapped in `…`, followed by the answer; streaming responses likewise return it in `delta.content`. The example above strips it with a regular expression.
| Model | Turning off thinking |
|---|---|
| MiniMax M3 | Pass `"thinking": {"type": "disabled"}`; thinking content no longer appears in the answer |
| MiniMax M2.7, M2.7 HighSpeed | Not supported; the model still thinks when it is passed |
```python filename="minimax_no_thinking.py"
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"])
resp = client.chat.completions.create(
model="minimax/minimax-m3",
messages=[{"role": "user", "content": "A number plus 3 times itself, minus 12, equals 36. What is the number? Answer with the number only."}],
extra_body={"thinking": {"type": "disabled"}},
)
print(resp.choices[0].message.content)
```
- MiniMax M3 accepts only `adaptive` and `disabled` for `thinking.type`; `enabled` returns 400.
- Thinking tokens count toward `max_tokens`. If the limit is too low, the answer may stop inside the thinking content, with `finish_reason` set to `length`.
- Thinking tokens are billed at the output rate; the count is in `usage.completion_tokens_details.reasoning_tokens`.
## Use in Claude Code
MiniMax models support the Anthropic-native API at `https://api.ofox.ai/anthropic`. On this API, thinking content is returned as separate `thinking` blocks and the answer is in `text` blocks, so you don't need to strip think tags yourself.
**Claude Code settings**
- ANTHROPIC_BASE_URL: `https://api.ofox.ai/anthropic`
- ANTHROPIC_AUTH_TOKEN: Paste your OfoxAI API key
- ANTHROPIC_MODEL: `minimax/minimax-m3`
```python filename="minimax_anthropic.py"
import os
import anthropic
client = anthropic.Anthropic(base_url="https://api.ofox.ai/anthropic", api_key=os.environ["OFOX_API_KEY"])
resp = client.messages.create(
model="minimax/minimax-m2.7",
max_tokens=4096,
messages=[{"role": "user", "content": "A number plus 3 times itself, minus 12, equals 36. What is the number?"}],
)
for block in resp.content:
print(block.type, ":", getattr(block, "thinking", None) or block.text)
```
- MiniMax M2.7 and M2.7 HighSpeed always return `thinking` blocks.
- MiniMax M3 returns `thinking` blocks when you pass `"thinking": {"type": "adaptive"}` or `{"type": "enabled", "budget_tokens": 2000}`, and only `text` blocks when you pass `{"type": "disabled"}`.
For full Claude Code setup steps, see [Claude Code setup](https://ofox.ai/docs/integrations/claude-code).
## Image input
Only MiniMax M3 supports image input, using the standard `image_url` content block; see [Vision](https://ofox.ai/docs/develop/guides/vision) for the syntax. MiniMax M2.7 and M2.7 HighSpeed are text-only; use M3 when you need image understanding.
## Other features
- **Tool calling**: uses the standard `tools` parameter and returns `tool_calls`.
- **Caching**: repeated request prefixes are cached automatically; the cached amount is in `usage.prompt_tokens_details.cached_tokens`. In our tests, with an identical prefix of about 5,600 tokens, the second request had over 5,000 cached tokens.
- **Structured output**: in our tests, passing a `json_schema` in `response_format` still produced plain text. If you need JSON, describe the fields in the prompt and parse the output yourself.
## Common errors
| HTTP · type | Error message | Cause | Fix |
|---|---|---|---|
| 400 `bad_request_error` | `invalid params, invalid thinking.type: "enabled" (allowed: adaptive, disabled) (2013)` | `thinking.type: enabled` was sent to MiniMax M3 on the OpenAI-compatible API | Omit `thinking` (thinking is on by default), or pass `disabled` |
| 400 `bad_request_error` | `invalid params, model[MiniMax-M3] does not support max tokens > 524288 (2013)` | `max_tokens` exceeds the limit | Lower `max_tokens` |
| 404 `model_not_found` | `Model 'MiniMax-M3' not found` | MiniMax's official model name was used | Use `minimax/minimax-m3` |
| Answer starts with `` | — | The OpenAI-compatible API returns thinking content in `content` | See [Thinking content](#thinking) |
For other general errors, see [Error Handling](https://ofox.ai/docs/develop/guides/error-handling).
## Official docs
- [MiniMax Open Platform · Docs](https://platform.minimaxi.com/docs)
## FAQ
**How do I write a MiniMax model ID?**
The standard format is minimax/minimax-m3; you can also omit the prefix and write minimax-m3. The official name MiniMax-M3 returns 404.
**Why does the MiniMax answer start with think tags?**
MiniMax thinks by default, and on the OpenAI-compatible API the thinking content is wrapped in think tags at the start of the answer. You can strip it with a regular expression; with MiniMax M3 you can also set the thinking type to disabled, or use the Anthropic API to get separate thinking blocks.
**Can I turn off thinking on MiniMax M2.7?**
No. MiniMax M2.7 and M2.7 HighSpeed still think when disabled is passed. Use MiniMax M3 if you need to turn thinking off.
**Can I use MiniMax in Claude Code?**
Yes. Set ANTHROPIC_BASE_URL to https://api.ofox.ai/anthropic and use minimax/minimax-m3 or minimax/minimax-m2.7 as the model.
**Can MiniMax understand images?**
Only MiniMax M3 supports image input. MiniMax M2.7 and M2.7 HighSpeed are text-only.