Chat · MiniMax
Chat Completions
Generate conversational responses using MiniMax language models through the unified chat completions endpoint.
/v1/chat/completionsSupported Models
| Model | Provider |
|---|---|
MiniMax-M1 | MiniMax |
Request
Body Parameters
modelstringrequiredModel ID — use "MiniMax-M1"
messagesarrayrequiredArray of message objects with role and content
temperaturenumberSampling temperature (0-2)
Default: 1
max_tokensintegerMaximum tokens to generate
top_pnumberNucleus sampling parameter
Default: 1
streambooleanEnable server-sent events streaming
Default: false
stopstring | string[]Stop sequences to halt generation
frequency_penaltynumberFrequency penalty (-2 to 2)
Default: 0
presence_penaltynumberPresence penalty (-2 to 2)
Default: 0
toolsarrayList of tools (functions) the model can call
tool_choicestring | objectControl tool selection behavior
Options: auto, none, required
response_formatobjectForce output format
Options: text, json_object
curl https://api.metriqual.com/v1/chat/completions \
-H "Authorization: Bearer mql_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMax-M1",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is quantum computing?"}
],
"temperature": 0.7,
"max_tokens": 500
}'const response = await mql.chat.create({
model: 'MiniMax-M1',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What is quantum computing?' }
],
temperature: 0.7,
max_tokens: 500
});
console.log(response.choices[0].message.content);response = mql.chat.create(
model="MiniMax-M1",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is quantum computing?"},
],
temperature=0.7,
max_tokens=500,
)
print(response["choices"][0]["message"]["content"])Response
Response Fields
idstringUnique completion ID
objectstringAlways "chat.completion"
createdintegerUnix timestamp
modelstringModel used for completion
choicesarrayArray of completion choices
usageobjectToken usage statistics
{
"id": "chatcmpl-minimax-abc123",
"object": "chat.completion",
"created": 1705320000,
"model": "MiniMax-M1",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing is a type of computation..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
}
}Streaming
Set stream: true to receive incremental responses via Server-Sent Events.
// Using async iterator
for await (const chunk of mql.chat.stream({
model: 'MiniMax-M1',
messages: [{ role: 'user', content: 'Tell me a story' }]
})) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}for chunk in mql.chat.stream(
model="MiniMax-M1",
messages=[{"role": "user", "content": "Tell me a story"}],
):
print(chunk["choices"][0]["delta"].get("content", ""), end="")