返回模型列表
Ministral 3B
mistralmistral/ministral-3b
API 使用指南
聊天补全
标准聊天补全,支持系统提示词和多轮对话。流式响应实现实时用户体验。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-d '{
"model": "mistral/ministral-3b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Classify this sentence: The cat sat on the mat."}
],
"temperature": 0.1,
"max_tokens": 256,
"stream": true
}'视觉(图像理解)
Ministral 3 3B 包含一个 4 亿参数的视觉编码器,每个提示支持最多 10 张图片。在 content 数组中通过 base64 data URL 或远程 URL 发送图像。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-d '{
"model": "mistral/ministral-3b",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in detail."},
{"type": "image_url", "image_url": {"url": "https://therouter.ai/assets/vision-sample.png"}}
]
}
],
"max_tokens": 1024
}'函数调用(工具)
Ministral 3 3B 支持原生函数调用,通过工具定义实现。调用函数、解析工具调用 ID、执行并返回结果——全部在标准 chat completions 端点内完成。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-d '{
"model": "mistral/ministral-3b",
"messages": [
{"role": "user", "content": "What is the weather like in Paris?"}
],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
}],
"tool_choice": "auto",
"temperature": 0.1
}'结构化 JSON 输出
使用 response_format 强制结构化 JSON 输出,适用于数据提取和分类流程。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-d '{
"model": "mistral/ministral-3b",
"messages": [
{"role": "user", "content": "Extract the name, date, and amount from this invoice."}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "invoice_extract",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"date": {"type": "string"},
"amount": {"type": "number"}
},
"required": ["name", "date", "amount"],
"additionalProperties": false
}
}
},
"temperature": 0.1
}'