Back to Models

GPT-5-Codex

openaiopenai/gpt-5-codex

API guide

Chat completion

Via TheRouter, gpt-5-codex is called through the standard chat completions endpoint. TheRouter abstracts the native Responses API to the familiar chat completions interface.

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"
  }'

Tool calling

GPT-5-Codex supports full GPT-5 tool-calling including parallel tool calls and custom_tools with grammar constraints. This powers Codex's filesystem, terminal, and web search interactions.

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"
  }'

Streaming

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
  }'
Fact ledger β€” every claim on this page traces here
sourceURLretrieved
Release dateopenai.com β†—2026-05-28verified
Training cutoffβ€”β€”unknown
OpenAI model idplatform.openai.com β†—2026-05-28verified
API availabilityopenai.com β†—2026-05-28verified
Dynamic reasoningopenai.com β†—2026-05-28verified
Autonomous executionopenai.com β†—2026-05-28verified
Licenseβ€”β€”verified
SWE-bench Verifiedopenai.com β†—2026-05-28verified
Code Refactoringopenai.com β†—2026-05-28verified
Code Review Accuracyopenai.com β†—2026-05-28verified
OpenAI releases GPT-5.5 with stronger Codex performanceopenai.com β†—2026-05-28verified
OpenAI releases GPT-5.3-Codex system cardopenai.com β†—2026-05-28verified
OpenAI launches GPT-5.2-Codex with SOTA on agentic coding benchmarksopenai.com β†—2026-05-28verified
OpenAI releases GPT-5-Codex for agentic coding in Codexopenai.com β†—2026-05-28verified
What is the difference between GPT-5 and GPT-5-Codex?openai.com β†—2026-05-28to verify
Can I use GPT-5-Codex via TheRouter's API?openai.com β†—2026-05-28to verify
How does GPT-5-Codex pricing compare to GPT-5?openai.com β†—2026-05-28to verify
Is GPT-5-Codex good for non-coding tasks?openai.com β†—2026-05-28to verify
Help & contact