MiniMax
This page provides information about MiniMax models available on AvalAI.
MiniMax develops models for language, speech, video, and music. Its latest M-series addition, MiniMax M3.1 Flash, focuses on coding, tool-driven work, and long-context tasks at lower token prices. AvalAI exposes it as minimax-m3.1-flash. The sections below also retain M3 and earlier M-series models; each model has its own prices and constraints. Official model overview
Available Models
- MiniMax M3.1 Flash:
minimax-m3.1-flash, available from AvalAI tier 0, with separate ordinary-input, cached-input, and output rates. - MiniMax M3: the preceding multimodal model, with its own context-dependent pricing.
Text and Chat Models
MiniMax offers powerful language models for text generation and agentic applications.
minimax-m3.1-flash
MiniMax announced M3.1 Flash on October 19, 2026 for coding, agentic workflows, computer-use tasks, and long-context work. The official launch describes more aggressive sparsity to improve inference efficiency. Those are provider capabilities and measurements; they do not establish a hosted computer-control service or a latency guarantee on AvalAI.
AvalAI access and catalog limits
| Item | AvalAI value |
|---|---|
| Public request model ID | minimax-m3.1-flash |
| Minimum account tier | 0 |
| Shared baseline endpoint | POST https://api.avalai.ir/v1/chat/completions |
| Catalog input ceiling | 1,048,576 tokens |
| Catalog output ceiling | 1,048,576 tokens |
| Catalog capability flags | Function calling, vision, response schemas, reasoning, and tool choice |
The two catalog ceilings are separate fields, not a promise that a request can use both in full. MiniMax's model guide documents a 1,000,000-token context window, while its Chat Completions reference states a 524,288-token maximum generation length, with 131,072 tokens recommended. These provider limits differ from AvalAI's catalog values. Size a request for the actual route's accepted context and output budget; the catalog output ceiling is not a provider guarantee of a one-million-token response.
The example below documents the shared text Chat Completions baseline. Catalog capability flags identify advertised model features, but do not verify every multimodal payload, reasoning field, or strict response-schema combination. MiniMax's own Messages and Responses documentation does not establish those endpoints or provider-hosted tools for this model on AvalAI. Consult the Chat Completions reference and validate the exact extension your application needs.
AvalAI pricing and prompt caching
All rates below are USD per 1,000,000 tokens:
| Ordinary input | Cached input | Output |
|---|---|---|
$0.15 | $0.015 | $0.60 |
Cached input applies only to tokens that actually hit the cache. The current Flash catalog has no separate cache-creation price; do not borrow the creation prices or context-dependent tiers of older MiniMax models. The official pricing page confirms the same three flat Flash rates.
Upstream prompt caching works automatically on repeated prefixes for requests with at least 512 input tokens, matching the tool list, system prompts, and user messages in that order. Keep stable content before changing content to improve reuse. MiniMax does not support manual Anthropic cache_control for M3.1 Flash. This upstream behavior does not guarantee an AvalAI cache hit or a particular cache lifetime. The short request below demonstrates text generation, not caching.
For Chat Completions, inspect actual usage.prompt_tokens and, when returned, usage.prompt_tokens_details.cached_tokens. Count cached tokens within the total input, rather than adding them a second time. A request's token estimate is:
USD = (uncached_input_tokens × 0.15
+ cached_input_tokens × 0.015
+ output_tokens × 0.60) / 1,000,000Provider capabilities and constraints
MiniMax's official API documents text, image, and video input, tool calling, and interleaved reasoning for M3.1 Flash. The model can reason between tool turns, and a client should return the complete assistant message, including any reasoning and tool calls, when continuing a supported tool workflow. A simple turn can omit reasoning content, so check whether the field exists before reading it. See the tool-use guide.
The following field mapping describes MiniMax's upstream protocols:
| Upstream protocol | Thinking-depth field | Reasoning output | Output-budget field |
|---|---|---|---|
| Chat Completions | reasoning_effort | reasoning_content | max_completion_tokens; legacy max_tokens |
| Messages | output_config.effort | thinking content blocks | max_tokens |
| Responses | reasoning.effort | Reasoning output items | max_output_tokens |
- Thinking is required upstream. Depth accepts
low,medium,high,xhigh, andmax, defaulting tomax. Higher depth can consume more output tokens and increase latency.thinking: {"type": "disabled"}and an effort ofnonereturn HTTP 400 for Flash;reasoning_split: falseis also unsupported. - Sampling controls are fixed upstream. MiniMax currently uses
temperature: 1andtop_p: 0.95; supplied values do not tune generation. Flash does not supportservice_tier, so MiniMax M3's Priority option does not apply. - Structured output needs its own check. AvalAI's catalog marks response-schema support, but MiniMax's current Chat request schema does not list
response_format, and its Responses schema lists onlytext.format.type: "text". Do not infer provider strict JSON Schema support from that catalog flag. - Speed and benchmarks are provider reports. The launch reports output reaching 200+ tokens per second and a median above 170 tokens per second. These measurements are not an AvalAI SLA. The launch says model weights will be released later; it does not establish an already downloadable Flash release.
See the official Chat Completions, Messages, and Responses references for their distinct upstream schemas.
Text request: curl, Python, and JavaScript
Set AVALAI_API_KEY in your server-side environment. The three tabs send the same model, prompt, and output budget. They use a 60-second timeout and disable automatic retries; a timed-out request may already have been processed and charged. Python requires the openai package, and JavaScript requires openai in a Node.js environment with ES modules.
curl --fail-with-body --connect-timeout 10 --max-time 60 --retry 0 https://api.avalai.ir/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AVALAI_API_KEY" \
-d '{
"model": "minimax-m3.1-flash",
"messages": [{"role": "user", "content": "Give a concise checklist for reviewing an API change."}],
"max_tokens": 256
}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
timeout=60.0,
max_retries=0,
)
response = client.chat.completions.create(
model="minimax-m3.1-flash",
messages=[{"role": "user", "content": "Give a concise checklist for reviewing an API change."}],
max_tokens=256,
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AVALAI_API_KEY,
baseURL: "https://api.avalai.ir/v1",
timeout: 60000,
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: "minimax-m3.1-flash",
messages: [{ role: "user", content: "Give a concise checklist for reviewing an API change." }],
max_tokens: 256,
});
console.log(response.choices[0].message.content);Illustrative complete response
The following response is synthetic, not a captured AvalAI result. Its identifier, timestamp, answer, and token counts are fictional. In particular, 20 uncached input tokens and 100 output tokens are arithmetic examples, not measured token counts for the request above. Optional usage, reasoning, and estimate fields can differ or be absent in a real response.
{
"id": "chatcmpl-minimax-flash-example",
"object": "chat.completion",
"created": 1792886400,
"model": "minimax-m3.1-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Check request and response schemas, authentication, compatibility, errors, rate limits, and tests before publishing the change."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 100,
"total_tokens": 120,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"estimated_cost": {
"unit": "0.0000630000",
"irt": null,
"exchange_rate": null
}
}The sample estimate is (20 × 0.15 + 100 × 0.60) / 1,000,000 = USD 0.000063. estimated_cost.unit is the USD amount as a decimal string; irt is a toman estimate and exchange_rate is the conversion rate used for that response. Both are null here because the illustration asserts no exchange rate. Use actual usage and account billing records for accounting; an absent estimate does not mean a free request.
Read the answer from choices[0].message.content and inspect finish_reason. If a real response ends with length or contains no final text, review the accepted output budget and any reasoning output before treating it as a complete answer. For authentication, model-ID, tier, or oversized-request failures, inspect the HTTP status and error body, correct the request, and retain avalai-request-id when returned. The examples make one attempt; they do not retry an unchanged invalid request.
For the availability announcement and the other models added alongside Flash, see Kimi, MiniMax, and Meta model additions.
minimax-m3
The minimax-m3 model is MiniMax's new flagship model, combining frontier coding capability, an ultra-long 1M-token context window, and native multimodality in a single model. Built on the proprietary MiniMax Sparse Attention (MSA) architecture, M3 supports autonomous task decomposition, tool invocation, and multi-step reasoning.
Key Features:
- Frontier Coding & Agentic Capabilities: SWE-Bench Pro 59.0%, Terminal-Bench 2.1 66.0%, MCP Atlas 74.2%, BrowseComp 83.5
- 1M Context Window: Powered by MiniMax Sparse Attention (MSA) for long-range agent tasks, long-range coding, and long-video understanding, with a guaranteed minimum of 512K tokens
- Native Multimodality: Trained with mixed-modality data from step zero, supporting image and video input
- Toggleable Thinking: Switch reasoning on for complex agentic and long-horizon tasks, or off for faster, latency-sensitive scenarios — both modes share the same pricing
- Autonomous Long-Horizon Tasks: Capable of multi-hour autonomous execution with tool calling and self-validation
- Context-Aware Pricing: Standard rate for the common ≤512K input range, with a higher long-context rate only above 512K tokens
Pricing:
| Tier | Input | Cached Input | Output |
|---|---|---|---|
| ≤512K tokens | $0.60/1M tokens | $0.12/1M tokens | $2.40/1M tokens |
| Above 512K tokens | $1.20/1M tokens | $0.24/1M tokens | $4.80/1M tokens |
Use Cases:
- Frontier agentic coding and software engineering
- Long-context tasks: full-repository code understanding, ultra-long document parsing
- Multimodal understanding with image and video input
- Long-horizon autonomous agent workflows
- Multi-step reasoning and tool-driven automation
Endpoint Support:
v1/chat/completions: Full support via the OpenAI-compatible APIv1/messages: Full support via the Anthropic Messages API formatv1/responses: Partial support (text input/output and basic tool use)
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m3",
messages=[
{
"role": "user",
"content": "Refactor this Python function for better performance and explain your reasoning.",
}
],
max_tokens=8192,
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m3` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Refactor this Python function for better performance and explain your reasoning.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2.1
The minimax-m2.1 model is MiniMax's flagship reasoning model with o3-level performance. It excels at multi-programming language capabilities and agentic workflows.
Key Features:
- Exceptional Multi-Programming Language Capabilities: Systematically enhanced performance in Rust, Java, Golang, C++, Kotlin, Objective-C, TypeScript, JavaScript, and more
- o3-Level Reasoning: Combines deep reasoning with up to 20x better efficiency
- Outstanding Agent/Tool Scaffolding: Excellent performance across Claude Code, Cline, Kilo Code, Roo Code, and BlackBox
- Interleaved Thinking: Native support for reasoning between tool interactions with
thinkingblocks - Concise and Efficient Responses: Improved response speed and reduced token consumption
- 204K Context Window: Supports extensive conversations and document processing
- 128K Max Output Tokens: Extended generation capability for complex tasks
- Output Speed: Approximately 60 tokens per second
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.03/1M tokens | $0.375/1M tokens | $1.20/1M tokens |
Use Cases:
- Complex coding tasks and software engineering
- Agentic automation and tool use workflows
- Multi-language programming projects
- Code review and refactoring
- Technical documentation generation
- Research and analysis tasks
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.1",
messages=[
{
"role": "user",
"content": "Implement a concurrent web crawler in Rust with rate limiting.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.1` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Implement a concurrent web crawler in Rust with rate limiting.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2.1-lightning
The minimax-m2.1-lightning model is a faster variant of M2.1, optimized for speed while maintaining strong reasoning capabilities.
Key Features:
- Output Speed: Approximately 100 tokens per second (60% faster than M2.1)
- Same 204K context window as M2.1
- Optimized for latency-sensitive applications
- Full tool calling and function support
- Maintains reasoning quality with improved throughput
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.03/1M tokens | $0.375/1M tokens | $2.40/1M tokens |
Use Cases:
- Real-time code assistance and IDE integrations
- Interactive chat applications requiring fast responses
- Live coding sessions and pair programming
- Time-sensitive agentic workflows
- High-throughput batch processing
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.1-lightning",
messages=[
{
"role": "user",
"content": "Explain the difference between async/await and Promises in JavaScript.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.1-lightning` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Explain the difference between async/await and Promises in JavaScript.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2.5
The minimax-m2.5 model is an earlier MiniMax flagship designed for real-world productivity with SOTA performance in coding, agentic tool use, and office work tasks.
Key Features:
- SOTA Coding Performance: 80.2% on SWE-Bench Verified, 51.3% on Multi-SWE-Bench
- Advanced Search & Tool Calling: 76.3% on BrowseComp with context management
- 37% Faster Than M2.1: Improved task decomposition and token efficiency
- Spec-Writing Architecture: Model actively plans features, structure, and UI design before coding
- 10+ Programming Languages: Go, C, C++, TypeScript, Rust, Kotlin, Python, Java, JavaScript, PHP, Lua, Dart, Ruby
- Full Development Lifecycle: From 0-to-1 system design to 90-to-100 code review and testing
- Office Work Integration: Deep collaboration with finance, law, and social sciences professionals
- 204K Context Window: Supports extensive conversations and document processing
- Output Speed: Approximately 50 tokens per second
- Built-in Reasoning: Thinking content in
<think>tags, separable viareasoning_splitparameter
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.03/1M tokens | $0.375/1M tokens | $1.20/1M tokens |
Use Cases:
- Agentic coding and software engineering
- Multi-programming language projects
- Complex search and research tasks
- Office work automation (Word, PowerPoint, Excel)
- Financial modeling and analysis
- Code review and refactoring
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.5",
messages=[
{
"role": "user",
"content": "Implement a rate-limited concurrent web crawler in Rust with proper error handling.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.5` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Implement a rate-limited concurrent web crawler in Rust with proper error handling.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
Reasoning Content:
MiniMax M2.5 includes built-in reasoning capabilities. By default, the model's thinking process appears within <think> and </think> tags in the response content. You can use the reasoning_split parameter to separate this content into a dedicated field.
# Using reasoning_split to separate thinking content
response = client.chat.completions.create(
model="minimax-m2.5",
messages=[{"role": "user", "content": "What is 25 * 37?"}],
extra_body={"reasoning_split": True},
)
# Access separated reasoning content
message = response.choices[0].message
print(f"Reasoning: {message.reasoning_details}") # The thinking process
print(f"Answer: {message.content}") # Only the final answerResponses API version This version uses `gpt-5.5` because `minimax-m2.5` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="What is 25 * 37?",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
When managing conversation history with tool calls, append the full response message object (including tool_calls field) to preserve context. For more details on the reasoning_split parameter, see Provider-Specific Parameters.
minimax-m2.5-lightning
The minimax-m2.5-lightning model is the ultra-fast variant of M2.5, optimized for speed while maintaining identical capabilities.
Key Features:
- Output Speed: Approximately 100 tokens per second (2x faster than other frontier models)
- Same Capabilities as M2.5: Identical intelligence with higher throughput
- On Par with Claude Opus 4.6: Matches completion speed of leading models
- Low-Cost Operation: $0.30 per hour at 100 TPS continuous operation
- 204K context window
- Full caching support
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.03/1M tokens | $0.375/1M tokens | $2.40/1M tokens |
Use Cases:
- Real-time code assistance and IDE integrations
- Interactive chat applications requiring fast responses
- Live coding sessions and pair programming
- Time-sensitive agentic workflows
- High-throughput batch processing
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.5-lightning",
messages=[
{
"role": "user",
"content": "Explain the difference between async/await and Promises in JavaScript.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.5-lightning` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Explain the difference between async/await and Promises in JavaScript.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2.7
The minimax-m2.7 model is a prior MiniMax flagship featuring revolutionary self-evolution capabilities, becoming the first model to deeply participate in its own evolution. It achieves state-of-the-art performance across coding, agentic tasks, and complex skill execution.
Key Features:
- Self-Evolution Architecture: First model to deeply participate in own evolution, redesigning and improving itself
- SOTA Coding Performance: 56.22% on SWE-Pro benchmark, leading among all commercial models
- Advanced Reasoning: Matches top frontier models without extended thinking time
- Agent Teams Support: Multi-agent collaboration for complex agentic workflows
- 97% Skill Adherence: Maintains consistency across 40+ complex skill definitions
- VIBE-Pro Score: 55.6% for vibe-based generation quality
- Terminal Bench 2: 57.0% score on terminal-based tasks
- Output Speed: Approximately 60 tokens per second
- Built-in Reasoning: Thinking content in
<think>tags, separable viareasoning_splitparameter
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.06/1M tokens | $0.375/1M tokens | $1.20/1M tokens |
Use Cases:
- Complex agentic coding and software development
- Multi-agent team collaboration workflows
- Self-improving AI system development
- Advanced skill-following applications
- High-reliability production deployments
- Research and development automation
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.7",
messages=[
{
"role": "user",
"content": "Design a microservices architecture for a real-time collaborative document editor with conflict resolution.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.7` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
input=[
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Design a microservices architecture for a real-time collaborative document editor with conflict resolution.",
},
{"type": "input_file", "file_id": "file_abc123"},
],
}
],
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
Reasoning Content:
MiniMax M2.7 includes built-in reasoning capabilities. By default, the model's thinking process appears within <think> and </think> tags in the response content. You can use the reasoning_split parameter to separate this content into a dedicated field.
# Using reasoning_split to separate thinking content
response = client.chat.completions.create(
model="minimax-m2.7",
messages=[
{
"role": "user",
"content": "What are the tradeoffs between monolithic and microservices architectures?",
}
],
extra_body={"reasoning_split": True},
)
# Access separated reasoning content
message = response.choices[0].message
print(f"Reasoning: {message.reasoning_details}") # The thinking process
print(f"Answer: {message.content}") # Only the final answerResponses API version This version uses `gpt-5.5` because `minimax-m2.7` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="What are the tradeoffs between monolithic and microservices architectures?",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2.7-highspeed
The minimax-m2.7-highspeed model is the ultra-fast variant of M2.7, optimized for maximum speed while maintaining identical self-evolution capabilities.
Key Features:
- Output Speed: Approximately 100 tokens per second (fastest in class)
- Same Capabilities as M2.7: Identical self-evolution intelligence with higher throughput
- Agent Teams Support: Full multi-agent collaboration capabilities at high speed
- 97% Skill Adherence: Maintains consistency across 40+ complex skills
- Low-Latency Operation: Ideal for real-time interactive applications
- Full caching support with optimized pricing
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.60/1M tokens | $0.06/1M tokens | $0.375/1M tokens | $2.40/1M tokens |
Use Cases:
- Real-time agentic workflows requiring instant responses
- Interactive coding assistants and IDE integrations
- Live multi-agent team coordination
- High-throughput batch processing
- Time-sensitive production applications
- Streaming chat applications
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.7-highspeed",
messages=[
{
"role": "user",
"content": "Explain the CAP theorem and its implications for distributed database design.",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.7-highspeed` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Explain the CAP theorem and its implications for distributed database design.",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
minimax-m2
The minimax-m2 model is the previous generation model with strong agentic capabilities, offering a cost-effective option for general tasks.
Key Features:
- 204K context window
- Advanced reasoning capabilities
- Tool calling support
- Cost-effective option for production applications
- Strong performance on coding and reasoning tasks
Pricing:
| Input | Cached Input | Cache Creation | Output |
|---|---|---|---|
| $0.30/1M tokens | $0.03/1M tokens | $0.375/1M tokens | $1.20/1M tokens |
Use Cases:
- General text generation and understanding
- Coding assistance and code generation
- Content creation and summarization
- Question answering and analysis
- Agentic workflows with tool use
SDK Access Methods
The new M3.1 Flash baseline uses the OpenAI SDK and /v1/chat/completions, as shown above. The older-model examples below describe two SDK approaches; their Messages examples do not establish Messages support for Flash:
| SDK | Base URL | Endpoint | Best For |
|---|---|---|---|
| OpenAI SDK | https://api.avalai.ir/v1 | /v1/chat/completions | Standard chat completions |
| Anthropic SDK | https://api.avalai.ir (without /v1) | /v1/messages | Native thinking blocks, tool use |
Usage Examples
OpenAI SDK - Basic Usage
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
response = client.chat.completions.create(
model="minimax-m2.1",
messages=[
{
"role": "user",
"content": "Implement a JWT authentication system in Node.js with refresh tokens",
}
],
)
print(response.choices[0].message.content)Responses API version This version uses `gpt-5.5` because `minimax-m2.1` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Implement a JWT authentication system in Node.js with refresh tokens",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
OpenAI SDK - Function Calling
from openai import OpenAI
client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather information for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, e.g. Tokyo",
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "Temperature unit",
},
},
"required": ["location"],
},
},
}
]
response = client.chat.completions.create(
model="minimax-m2.1",
messages=[{"role": "user", "content": "What is the weather like in Tokyo?"}],
tools=tools,
tool_choice="auto",
)
print(response.choices[0].message)Responses API version This version uses `gpt-5.5` because `minimax-m2.1` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
tools = [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location.",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
"additionalProperties": False,
},
}
]
response = client.responses.create(
model="gpt-5.6-luna",
input="What is the weather like in Tokyo?",
tools=tools,
)
for item in response.output:
if item.type == "function_call":
print(item.name, item.arguments)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
Anthropic SDK - Basic Usage
import anthropic
client = anthropic.Anthropic(
api_key="your-avalai-api-key",
base_url="https://api.avalai.ir", # Note: without /v1
)
message = client.messages.create(
model="minimax-m2.1",
max_tokens=4096,
messages=[
{"role": "user", "content": "Implement a JWT authentication system in Node.js"}
],
)
print(message.content)Anthropic SDK - Tool Use with Interleaved Thinking
MiniMax M2.1 natively supports Interleaved Thinking, enabling it to reason between each round of tool interactions. Before every tool use, the model reflects on the current environment and tool outputs to decide its next action.
import anthropic
import json
client = anthropic.Anthropic(
api_key="your-avalai-api-key",
base_url="https://api.avalai.ir", # Note: without /v1
)
# Define tool: weather query
tools = [
{
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first.",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, US",
}
},
"required": ["location"],
},
}
]
def send_messages(messages):
response = client.messages.create(
model="minimax-m2.1",
max_tokens=4096,
messages=messages,
tools=tools,
)
return response
def process_response(response):
thinking_blocks = []
text_blocks = []
tool_use_blocks = []
for block in response.content:
if block.type == "thinking":
thinking_blocks.append(block)
print(f"💭 Thinking>\n{block.thinking}\n")
elif block.type == "text":
text_blocks.append(block)
print(f"💬 Model>\t{block.text}")
elif block.type == "tool_use":
tool_use_blocks.append(block)
print(
f"🔧 Tool>\t{block.name}({json.dumps(block.input, ensure_ascii=False)})"
)
return thinking_blocks, text_blocks, tool_use_blocks
# User query
messages = [{"role": "user", "content": "How's the weather in San Francisco?"}]
print(f"\n👤 User>\t {messages[0]['content']}")
# Model returns first response (may include tool calls)
response = send_messages(messages)
thinking_blocks, text_blocks, tool_use_blocks = process_response(response)
# If tool calls exist, execute tools and continue conversation
if tool_use_blocks:
# ⚠️ Critical: Append the assistant's complete response to message history
messages.append({"role": "assistant", "content": response.content})
# Execute tool and return result (simulating weather API call)
print(f"\n🔨 Executing tool: {tool_use_blocks[0].name}")
tool_result = "24℃, sunny"
print(f"📊 Tool result: {tool_result}")
# Add tool execution result
messages.append(
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": tool_use_blocks[0].id,
"content": tool_result,
}
],
}
)
# Get final response
final_response = send_messages(messages)
process_response(final_response)Interleaved Thinking
MiniMax M2.1's Interleaved Thinking capability allows the model to reason between tool interactions, making it exceptionally powerful for agentic workflows.
How It Works
- Before Tool Use: The model reflects on the current environment and decides which tool to call
- After Tool Result: The model analyzes the tool output and plans the next action
- Chain of Thought: The complete reasoning chain is preserved across multiple tool interactions
Best Practices
- Preserve Full Response: Always append the complete
response.content(including thinking blocks) to message history - Don't Modify Content: Keep thinking blocks intact - they maintain reasoning continuity
- Use Anthropic SDK: For native thinking block support, use the Anthropic SDK with
base_url="https://api.avalai.ir"
Response Format
When using the Anthropic SDK, responses include three block types:
| Block Type | Description |
|---|---|
thinking | Model's internal reasoning process |
text | Text content output by the model |
tool_use | Tool call information with function name and arguments |
JavaScript/TypeScript Examples
OpenAI SDK
import { OpenAI } from "openai";
const client = new OpenAI({
apiKey: process.env.AVALAI_API_KEY,
baseURL: "https://api.avalai.ir/v1",
});
const response = await client.chat.completions.create({
model: "minimax-m2.1",
messages: [
{
role: "user",
content: "Implement a JWT authentication system in Node.js with refresh tokens",
},
],
});
console.log(response.choices[0].message.content);Responses API version This version uses `gpt-5.5` because `minimax-m2.1` may not be enabled for `/v1/responses` in the current AvalAI model data.
Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AVALAI_API_KEY"],
base_url="https://api.avalai.ir/v1",
)
response = client.responses.create(
model="gpt-5.6-luna",
instructions="You are a helpful assistant.",
input="Implement a JWT authentication system in Node.js with refresh tokens",
)
print(response.output_text)messages→input- system message →
instructionsor adeveloperitem choices[0].message.content→response.output_text- for tools and multimodal output, inspect
response.outputby itemtype.
Anthropic SDK
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.AVALAI_API_KEY,
baseURL: "https://api.avalai.ir", // Note: without /v1
});
const message = await client.messages.create({
model: "minimax-m2.1",
max_tokens: 4096,
messages: [
{ role: "user", content: "Implement a JWT authentication system in Node.js" }
],
});
console.log(message.content);Model Comparison
The Flash column uses AvalAI catalog values. Its distinct upstream context and generation limits are explained above; the earlier-model columns are retained for reference.
| Feature | minimax-m3.1-flash | minimax-m3 | minimax-m2.7 | minimax-m2.5 | minimax-m2.1 |
|---|---|---|---|---|---|
| Context Window | 1,048,576-token catalog input ceiling; upstream context 1,000,000 | Up to 1,000,000 tokens | 204,800 tokens | 1,000,000 tokens | 204,800 tokens |
| Multimodal Input | Vision flag in catalog; provider documents text, image, video | Text, Image, Video | Text | Text | Text |
| Tool Calling | Catalog flag: yes | ✓ | ✓ | ✓ | ✓ |
| Input Price | $0.15/1M | $0.60/1M (≤512K) | $0.30/1M | $0.30/1M | $0.30/1M |
| Output Price | $0.60/1M | $2.40/1M (≤512K) | $1.20/1M | $1.20/1M | $1.20/1M |
| Best For | Coding and agentic workflows | Frontier coding, 1M context, multimodal | Self-evolution, Agent Teams | SOTA coding, productivity | Complex reasoning |