返回模型列表

Mistral Small 4

mistralmistral/mistral-small-4

API 使用指南

Chat 调用

基础对话调用,用于测试端点或执行对话任务。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [
      {"role": "user", "content": "Explain the difference between MoE and dense transformer models"}
    ]
  }'

流式调用

增量返回 token 实现实时体验。Mistral Small 4 通过标准 OpenAI 流式接口支持 Server-Sent Events。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [{"role": "user", "content": "Write a haiku about AI"}],
    "stream": true
  }'

工具调用

Mistral Small 4 通过 OpenAI 兼容的 tools API 支持原生工具/函数调用。自部署 vLLM 场景推荐使用 'mistral' tool call 解析器。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [{"role": "user", "content": "What is the weather in Paris?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {"type": "string", "description": "City name"}
          },
          "required": ["location"]
        }
      }
    }],
    "tool_choice": "auto"
  }'

视觉(多模态)

将图片与文本一起发送,用于文档分析、UI 审查和视觉问答。支持标准 OpenAI 视觉格式(base64 或 URL 图片输入)。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What does this chart show?"},
        {"type": "image_url", "image_url": {"url": "https://therouter.ai/assets/vision-sample.png"}}
      ]
    }]
  }'

推理(reasoning_effort)

Mistral Small 4 的标志性功能——reasoning_effort 参数可按请求控制推理深度。'none' 为快速对话,'high' 为深度分步推理(相当于 Magistral 级别)。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [{"role": "user", "content": "How many r's are in the word 'strawberry'? Think step by step."}],
    "reasoning_effort": "high"
  }'

JSON 模式

使用 response_format 确保结构化 JSON 输出。Mistral Small 4 支持标准 OpenAI JSON 模式 API。

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-4",
    "messages": [{"role": "user", "content": "Extract name, age, and city from: John is 30 years old from London"}],
    "response_format": {"type": "json_object"}
  }'
事实档案 — 本页每条断言可在此回溯来源
来源URL采集于
发布日期mistral.ai ↗2026-05-27已核实
架构docs.mistral.ai ↗2026-05-27已核实
上游上下文长度huggingface.co ↗2026-05-27已核实
训练数据截止——未知
许可huggingface.co ↗2026-05-27已核实
支持的推理后端huggingface.co ↗2026-05-27已核实
自部署最低硬件要求mistral.ai ↗2026-05-27待核实
AA LCRmistral.ai ↗2026-05-27待核实
LiveCodeBenchmistral.ai ↗2026-05-27待核实
AIME 2025mistral.ai ↗2026-05-27待核实
Mistral Small 4 正式发布mistral.ai/news ↗2026-05-27已核实
Mistral Small 4 和 Mistral Small 3 有什么不同?mistral.ai ↗2026-05-27待核实
能否通过标准 OpenAI Python/TypeScript SDK 调用 Mistral Small 4?docs.therouter.ai ↗2026-05-27待核实
Mistral Small 4 是开源的吗?能否在自有硬件上运行?huggingface.co ↗2026-05-27待核实
reasoning_effort 参数如何工作?docs.mistral.ai ↗2026-05-27待核实
Mistral Small 4 的基准测试分数如何?mistral.ai ↗2026-05-27待核实
帮助与联系