1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const axios = require('axios');
const fs = require('fs');
const path = require('path');
// helper function to help you convert your local images into base64 format
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/minimax-m3";
const data = {
"messages": [
{
"role": "user",
"content" : "tell me a joke on cats"
},
{
"role": "assistant",
"content" : "here is a joke about cats..."
},
{
"role": "user",
"content" : "now a joke on dogs"
},
]
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();An array of objects containing the role and content
Could be "user", "assistant" or "system".
A string containing the user's query or the assistant's response.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
MiniMax M3 is a frontier open-weight large language model from MiniMax, built for coding, long-horizon agentic work, and long-context reasoning. It pairs a 1M-token context window with native multimodal training across text, image, and video, and returns text output. Under the hood, M3 is a Mixture-of-Experts model with roughly 428B total parameters and about 23B activated per token, so it delivers frontier quality without dense-model compute.
The headline architectural change is MiniMax Sparse Attention (MSA). Instead of comparing every token against every other token, MSA selects the key-value blocks that matter most, cutting per-token compute at long context to roughly one-twentieth of the previous generation while keeping quality steady. On Segmind, you send a single prompt and receive the model's text response synchronously — no polling required.
MiniMax M3 shines when tasks are long and multi-step rather than single-turn. Use it for multi-file refactors, bug fixes, and feature implementation; for agent loops that read files, call tools, and iterate; and for analyzing large codebases, logs, transcripts, or long documents in one pass. Its structured, low-filler responses make it a strong fit for technical analysis and detailed reports.
Put your instruction after large context with a bridging line such as "Based on the material above." Be explicit about role, tools, and the output format you want (JSON, structured Markdown, or a unified diff). For agent workflows, ask the model to plan before each step and verify after. Keep only the context the task needs — a huge window rewards relevance, not raw volume.
Is MiniMax M3 good for coding? Yes. It reaches frontier-range coding and agentic benchmarks and is designed for long-horizon software tasks.
What context length does it support? Up to 1,000,000 tokens, making full-repo and long-document reasoning practical.
Is it multimodal? M3 is natively trained on text, image, and video inputs; the Segmind endpoint accepts a text prompt and returns text.
How large is the model? It is a Mixture-of-Experts model with about 428B total parameters and roughly 23B active per token.
How do I get the best results? Provide clear roles, explicit output formats, and only the relevant context, then place your instruction last.