返回模型列表
GPT-4o
openaiopenai/gpt-4o
API 使用指南
Chat 调用
通过 TheRouter 的 OpenAI 兼容端点进行标准对话或文本输入输出。
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","messages":[{"role":"user","content":"Explain what GPT-4o is in one sentence."}]}'视觉 / 图像输入
GPT-4o 支持在对话消息中附带图片 URL 或 base64 编码图片。
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","messages":[{"role":"user","content":[{"type":"text","text":"Describe what is in this image"},{"type":"image_url","image_url":{"url":"https://therouter.ai/assets/vision-sample.png"}}]}]}'结构化输出 (JSON)
使用 response_format 让 GPT-4o 返回符合 schema 的合法 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","messages":[{"role":"user","content":"Extract the name, age, and city from: John is 32 and lives in Tokyo."}],"response_format":{"type":"json_object"}}'工具 / 函数调用
GPT-4o 原生支持工具调用,可在对话中进行结构化函数调用。
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","messages":[{"role":"user","content":"What is the weather in Tokyo?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]}'流式传输
逐 token 流式传输完成内容,实现低延迟用户体验。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Tell me a short story"}],"stream":true}'事实档案 — 本页每条断言可在此回溯来源
| 来源 | URL | 采集于 | |
|---|---|---|---|
| 发布日期 | openai.com ↗ | 2026-05-28 | 已核实 |
| 最新快照版本 | developers.openai.com ↗ | 2026-05-28 | 已核实 |
| 训练数据截止 | — | — | 单一来源 |
| 输入模态 | openai.com ↗ | 2026-05-28 | 已核实 |
| 输出模态 | openai.com ↗ | 2026-05-28 | 已核实 |
| 结构化输出 | platform.openai.com ↗ | 2026-05-28 | 已核实 |
| 最大输出 token | developers.openai.com ↗ | 2026-05-28 | 已核实 |
| 部署平台 | openai.com ↗ | 2026-05-28 | 已核实 |
| 许可 | — | — | 已核实 |
| MMLU | openai.com ↗ | 2026-05-28 | 已核实 |
| HumanEval | openai.com ↗ | 2026-05-28 | 已核实 |
| MMMU | openai.com ↗ | 2026-05-28 | 已核实 |
| MATH | openai.com ↗ | 2026-05-28 | 已核实 |
| GSM8K | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4o 从 ChatGPT 退役 | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4.1 发布:GPT-4o 的直接继任者 | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4o 2024 年 11 月快照发布 | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-4o 在 API 中是否仍可用? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o 和 GPT-4o Mini 有什么区别? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o 可以处理音频输入吗? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-4o 是推理模型吗? | openai.com ↗ | 2026-05-28 | 待核实 |