返回模型列表
GPT-4.1 Mini
openaiopenai/gpt-4.1-mini
API 使用指南
Chat 调用
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4.1-mini","messages":[{"role":"user","content":"Hello"}]}'流式传输
流式传输与 OpenAI SDK 完全一致 — 设置 stream: true 即可。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4.1-mini","messages":[{"role":"user","content":"Hello"}],"stream":true}'工具调用
GPT-4.1 Mini 通过 OpenAI 兼容 API 支持并行工具调用和函数定义。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4.1-mini","messages":[{"role":"user","content":"What is the weather in Tokyo?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get current temperature","parameters":{"type":"object","properties":{"location":{"type":"string"}}}}}],"tool_choice":"auto"}'结构化输出
设置 response_format 为 JSON schema,确保结构化解析。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4.1-mini","messages":[{"role":"user","content":"Extract name and age from: John is 30"}],"response_format":{"type":"json_schema","json_schema":{"name":"person","strict":true,"schema":{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"number"}},"additionalProperties":false}}}}'事实档案 — 本页每条断言可在此回溯来源
| 来源 | URL | 采集于 | |
|---|---|---|---|
| 发布日期 | 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 | 已核实 |
| GPQA Diamond | openai.com ↗ | 2026-05-28 | 已核实 |
| IFEval | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4.1 系列发布 | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4.1 Mini 与 GPT-4o Mini 相比如何? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4.1 Mini 可以在 ChatGPT 上使用吗? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4.1 Mini 支持结构化输出(JSON schema)吗? | openai.com ↗ | 2026-05-28 | 待核实 |