返回模型列表
GPT-4o Mini
openaiopenai/gpt-4o-mini
API 使用指南
Chat 调用
GPT-4o Mini 支持标准 chat completion,可选视觉/图像输入、工具调用、JSON 模式和流式输出。直接使用您已有的 OpenAI SDK — 只需更换模型名和 base URL。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Extract the date, vendor name, and total from this receipt in JSON."}
],
"response_format": {"type": "json_object"}
}'流式输出
逐 token 低延迟流式输出,适用于面向客户的实时聊天。GPT-4o Mini 的小尺寸模型带来极快的首 token 速度。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Write a 200-word summary of quantum computing."}],
"stream": true
}'工具调用
GPT-4o Mini 支持函数调用以提取结构化数据或触发外部动作,是高吞吐数据提取和分类管线的理想选择。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "What is the weather like in Tokyo today?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
}]
}'JSON 模式
通过 response_format 保证结构化 JSON 输出。GPT-4o Mini 被广泛应用于从收据、发票、邮件和聊天记录中进行高吞吐数据提取。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{"role": "system", "content": "Extract name, email, and intent as JSON."},
{"role": "user", "content": "Hi, I am Jane from Acme Corp, please email me the invoice at jane@acme.com."}
],
"response_format": {"type": "json_object"}
}'视觉 / 图像输入
GPT-4o Mini 支持图像输入,可用于 OCR、文档分析和视觉分类任务。结合 JSON 模式,可从收据、表格和截图中进行结构化提取。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Extract the total amount and date from this receipt."},
{"type": "image_url", "image_url": {"url": "https://therouter.ai/assets/vision-sample.png"}}
]
}
],
"response_format": {"type": "json_object"}
}'事实档案 — 本页每条断言可在此回溯来源
| 来源 | URL | 采集于 | |
|---|---|---|---|
| 发布日期 | openai.com ↗ | 2026-05-28 | 已核实 |
| 知识截止日期 | openai.com ↗ | 2026-05-28 | 已核实 |
| 最大输出 token | openai.com ↗ | 2026-05-28 | 已核实 |
| 输入模态 | openai.com ↗ | 2026-05-28 | 已核实 |
| 输出模态 | openai.com ↗ | 2026-05-28 | 已核实 |
| 许可协议 | — | — | 已核实 |
| 安全技术 | openai.com ↗ | 2026-05-28 | 已核实 |
| MMLU | openai.com ↗ | 2026-05-28 | 已核实 |
| MGSM | openai.com ↗ | 2026-05-28 | 已核实 |
| HumanEval | openai.com ↗ | 2026-05-28 | 已核实 |
| MMMU | openai.com ↗ | 2026-05-28 | 已核实 |
| LMSYS Chatbot Arena | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4.1、GPT-4.1 Mini 和 GPT-4.1 Nano 在 API 中发布 | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4o Mini 发布 — 替代 GPT-3.5 Turbo | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4.1 Mini 发布后,GPT-4o Mini 还能继续使用吗? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o Mini 是否支持函数/工具调用? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o Mini 的知识截止日期是什么时候? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o Mini 比之前的小模型更安全体现在哪些方面? | openai.com ↗ | 2026-05-28 | 待核实 |