返回模型列表

GPT-4.1

openaiopenai/gpt-4.1

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","messages":[{"role":"user","content":"Hello"}]}'

流式调用

GPT-4.1 支持服务端推送事件(SSE)流式输出,适合需要实时响应的对话界面和代理工作流。

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","messages":[{"role":"user","content":"Hello"}],"stream":true}'

函数调用 / 工具

GPT-4.1 经过针对性训练,工具调用更加可靠,无关编辑从 9% 降至 2% — 非常适合调用 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",
    "messages":[{"role":"user","content":"What is the weather in Tokyo?"}],
    "tools":[{"type":"function","function":{"name":"get_weather","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]}}}]
  }'

结构化输出(JSON)

GPT-4.1 支持 response_format 约束输出为有效 JSON — 适合数据提取、分类等需满足 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",
    "messages":[{"role":"user","content":"Extract the name and age from: John is 30"}],
    "response_format":{"type":"json_object"}
  }'

视觉理解

GPT-4.1 接受图像输入(文本 + 图像多模态)— 支持 base64 或 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-4.1",
    "messages":[
      {"role":"user","content":[
        {"type":"text","text":"Describe this chart"},
        {"type":"image_url","image_url":{"url":"https://therouter.ai/assets/vision-sample.png"}}
      ]}
    ]
  }'
事实档案 — 本页每条断言可在此回溯来源
来源URL采集于
发布日期openai.com ↗2026-05-28已核实
知识截止日期openai.com ↗2026-05-28已核实
许可openai.com ↗2026-05-28已核实
最大输出 tokensopenai.com ↗2026-05-28已核实
替代模型openai.com ↗2026-05-28已核实
SWE-bench Verifiedopenai.com ↗2026-05-28已核实
Scale MultiChallengeopenai.com ↗2026-05-28已核实
Video-MME (long, no subtitles)openai.com ↗2026-05-28已核实
Aider Polyglot (diff)openai.com ↗2026-05-28已核实
OpenAI 发布 GPT-4.1 系列:100 万上下文、更强编程、更低价格openai.com ↗2026-05-28已核实
GPT-4.5 Preview 弃用截止日期openai.com ↗2026-05-28已核实
GPT-4.1 是和 o3 一样的推理模型吗?openai.com ↗2026-05-28待核实
GPT-4.1 在编程方面相比 GPT-4o 如何?openai.com ↗2026-05-28待核实
我是否应该从 GPT-4.5 Preview 迁移到 GPT-4.1?openai.com ↗2026-05-28待核实
帮助与联系