返回模型列表
GPT-5-Codex
openaiopenai/gpt-5-codex
API 使用指南
Chat 调用
通过 TheRouter 使用标准 chat completions endpoint 调用。TheRouter 将原生 Responses API 抽象为熟悉的 chat completions 接口。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-codex",
"messages": [
{"role": "user", "content": "Write a Python script to parse logs and extract error counts for each module."}
],
"reasoning_effort": "medium"
}'工具调用
支持完整 GPT-5 工具调用,包括并行工具调用和带文法定制的 custom_tools。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-codex",
"messages": [
{"role": "user", "content": "Look at the src/ directory and list all test files"}
],
"tools": [{
"type": "function",
"function": {
"name": "list_files",
"description": "List files in a directory",
"parameters": { "type": "object", "properties": { "path": {"type": "string"} } }
}
}],
"tool_choice": "auto"
}'流式输出
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-5-codex",
"messages": [
{"role": "user", "content": "Refactor this function to use async/await"}
],
"stream": true
}'事实档案 — 本页每条断言可在此回溯来源
| 来源 | URL | 采集于 | |
|---|---|---|---|
| 发布日期 | openai.com ↗ | 2026-05-28 | 已核实 |
| 训练数据截止 | — | — | 未知 |
| OpenAI 模型 ID | platform.openai.com ↗ | 2026-05-28 | 已核实 |
| API 可用性 | openai.com ↗ | 2026-05-28 | 已核实 |
| 动态推理 | openai.com ↗ | 2026-05-28 | 已核实 |
| 自主执行时长 | openai.com ↗ | 2026-05-28 | 已核实 |
| 许可 | — | — | 已核实 |
| SWE-bench Verified | openai.com ↗ | 2026-05-28 | 已核实 |
| Code Refactoring | openai.com ↗ | 2026-05-28 | 已核实 |
| Code Review Accuracy | openai.com ↗ | 2026-05-28 | 已核实 |
| OpenAI 发布 GPT-5.5,Codex 性能更强 | openai.com ↗ | 2026-05-28 | 已核实 |
| OpenAI 发布 GPT-5.3-Codex 系统卡 | openai.com ↗ | 2026-05-28 | 已核实 |
| OpenAI 发布 GPT-5.2-Codex,agent 编程 SOTA | openai.com ↗ | 2026-05-28 | 已核实 |
| OpenAI 发布 GPT-5-Codex | openai.com ↗ | 2026-05-28 | 已核实 |
| GPT-5 和 GPT-5-Codex 有什么区别? | openai.com ↗ | 2026-05-28 | 待核实 |
| 我可以通过 TheRouter 的 API 使用 GPT-5-Codex 吗? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-5-Codex 的定价与 GPT-5 相比如何? | openai.com ↗ | 2026-05-28 | 待核实 |
| GPT-5-Codex 在非编程任务上表现出色吗? | openai.com ↗ | 2026-05-28 | 待核实 |