
统一Instruct、Reasoning(Magistral)和Devstral家族的混合模型:完成时间比Small 3快40%,吞吐量是3倍。
统一Instruct、Reasoning(Magistral)和Devstral家族的混合模型:完成时间比Small 3快40%,吞吐量是3倍。
也称为 Mistral AI Mistral Small 4
mistral-small-4/v1/chat/completionsPOST/v1/responsesPOST/v1/messagesPOST/v1beta/models/mistral-small-4:generateContentmistralai/mistral-small-4来自 EmpirioLabs 目录的实时按量计费价格。只为实际用量付费,没有月度最低消费。
Mistral Small 4 提供 OpenAI 兼容的 Chat Completions API。用你的 EmpirioLabs API 密钥把任意 OpenAI SDK 指向 https://api.empiriolabs.ai/v1,并使用模型 ID mistral-small-4。 在EmpirioLabs 控制台获取 API 密钥。
curl https://api.empiriolabs.ai/v1/chat/completions \
-H "Authorization: Bearer $EMPIRIOLABS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-small-4",
"messages": [
{"role": "user", "content": "Write a haiku about the ocean."}
]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.empiriolabs.ai/v1",
api_key="YOUR_EMPIRIOLABS_API_KEY",
)
response = client.chat.completions.create(
model="mistral-small-4",
messages=[{"role": "user", "content": "Write a haiku about the ocean."}],
)
print(response.choices[0].message.content)EmpirioLabs 上 Mistral Small 4 API 支持的请求参数。省略字段时使用默认值。
| 参数 | 类型 | 默认值 | 范围 / 值 | 描述 |
|---|---|---|---|---|
| reasoning_enabled | boolean | true | - | 启用扩展推理。当请求包含函数工具时不适用。 |
| tool_web_search | boolean | false | - | 启用web_search工具 |
| web_search_tier | enum | standard | standard, premium | 标准或高级网页搜索层。高级版使用更高质量的来源。 |
| tool_code_interpreter | boolean | false | - | 允许模型在沙盒中执行Python代码来计算和分析数据。 |
| tool_image_generation | boolean | false | - | 允许模型通过平台的图像生成工具内嵌生成图像。 |
| temperature | number | 0.7 | 0 到 1.5 | 采样温度。0 = 确定性,1.5 = 最大随机性。 |
| max_tokens | number | 4096 | 1 到 65536 | 回复中最多的代币。 |
| disable_formatting | boolean | false | - | 返回答案时不EmpirioLabs格式:引用保持为普通的[N]标记,不添加参考文献块。 |
| response_format | enum | - | - | 返回输出为有效的 JSON 对象(JSON 模式)。描述你在提示词中想要的字段。 |
Tools (web search, code interpreter, image generation) are billed only when actually invoked. Requests that include your own function tools use standard function calling, and the built-in tools are unavailable on those requests: a request cannot combine both at once. With a built-in tool turned on, input is limited to about 235,000 tokens per request.
当该模型在单一请求中调用内置工具(如网页搜索、代码解释器等)时,响应会携带一个归一化的usage.tool_usage映射,同时显示令牌计数。下例展示了形状、具体字段名称、单位以及出现的工具可能因提供者而略有不同:
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"cost_usd": 0.0042,
"tool_usage": {"web_search": 3, "code_interpreter": 1}
}工具数量已经被纳入cost_usd,显示出来是为了透明,方便你审计每工具的计费。当没有工具被调用时,该字段会被省略。
在 EmpirioLabs,Mistral Small 4 按量计费:输入 $0.15 每100万个提示词标记; 产出 $0.60 每100万个生成代币; 标准网页搜索 $0.084 每次通话; 高级网页搜索 $0.140 每次通话; 代码解释器 $0.084 每次通话; 图像生成 $0.280 每张图片。本页的实时价格表始终与 API 的实际计费一致。
Mistral Small 4 支持 256K token 的上下文窗口,每次响应最多 65,536 个输出 token。
兼容。Mistral Small 4 提供 OpenAI 兼容的 Chat Completions API,现有 OpenAI SDK 只需把 base_url 指向 https://api.empiriolabs.ai/v1 并把模型 ID 设为 mistral-small-4 即可使用。
可以。EmpirioLabs Playground在浏览器中以与 API 相同的参数运行 Mistral Small 4,你可以在写代码之前先测试提示词。
创建 EmpirioLabs 账户,然后在控制台的 API Keys生成密钥。计费使用按量付费的额度,只为实际发出的请求付费。