返回模型列表

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 模型 IDplatform.openai.com ↗2026-05-28已核实
API 可用性openai.com ↗2026-05-28已核实
动态推理openai.com ↗2026-05-28已核实
自主执行时长openai.com ↗2026-05-28已核实
许可——已核实
SWE-bench Verifiedopenai.com ↗2026-05-28已核实
Code Refactoringopenai.com ↗2026-05-28已核实
Code Review Accuracyopenai.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 编程 SOTAopenai.com ↗2026-05-28已核实
OpenAI 发布 GPT-5-Codexopenai.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待核实
帮助与联系