Back to Models

GPT-5-Codex

openaiopenai/gpt-5-codex

Version of GPT-5 optimized for agentic coding in Codex.

GPT-5-Codex is a specialized variant of GPT-5, further optimized for agentic software engineering inside OpenAI's Codex environment. Announced September 23, 2025, it is trained on complex real-world engineering tasks: building full projects from scratch, adding features and tests, debugging, performing large-scale refactors across hundreds of files, and conducting thorough code reviews. On TheRouter, openai/gpt-5-codex is priced identically to GPT-5 at $1.25/$10 per 1M tokens, with 400K context and supports the full set of GPT-5 parameters including reasoning_effort, verbosity, and custom_tools.

Unlike general-purpose GPT-5, GPT-5-Codex dynamically adapts its reasoning time based on task complexity β€” it produces 93.7% fewer tokens than GPT-5 for simple turns and spends twice as long reasoning on hard problems. It has been observed running independently for over 7 hours on complex tasks. OpenAI recommends GPT-5-Codex only for agentic coding in Codex or Codex-like environments, not as a general-purpose replacement for GPT-5.

Best for
  • β€’ Agentic coding in Codex β€” purpose-built for Codex CLI, IDE extension, cloud, and GitHub
  • β€’ Large-scale refactors β€” proven on tasks touching hundreds of files across Python, Go, and OCaml repos
  • β€’ Code review β€” catches critical bugs before shipping, fewer incorrect comments than GPT-5
  • β€’ Front-end web and mobile β€” improved human preference for desktop apps and mobile websites
Reach for something else if
  • β€’ General-purpose chat or QA β€” use GPT-5 for general reasoning tasks
  • β€’ High-volume cost-sensitive generation β€” same pricing as GPT-5; use gpt-5-mini for budget
  • β€’ Image or audio generation β€” text output only; use gpt-image-2 or gpt-audio-1.5
Context Length
400K
Max Output
128K
Input Priceper 1M tokens
$1.35/ 1M tokens
Output Priceper 1M tokens
$10.80/ 1M tokens

Modalities

textimage→text

Capabilities

Vision

Pricing Breakdown

TypeRate
Input$1.35 / 1M tokens
Output$10.80 / 1M tokens

Supported Parameters

temperaturemax_tokenstop_ptoolstool_choiceresponse_formatreasoningstop

Specifications

Release date2025-09-23openai.com β†—verified
Training cutoffNot publicly disclosedunknown
OpenAI model idgpt-5-codexplatform.openai.com β†—verified
API availabilityResponses API only (natively)openai.com β†—verified
Dynamic reasoning93.7% fewer tokens on simple turns vs GPT-5; 2x reasoning on hard tasksopenai.com β†—verified
Autonomous executionObserved >7 hours on complex tasksopenai.com β†—verified
LicenseOpenAI Terms of Use (proprietary, API-only)verified

Benchmarks

BenchmarkDistributionScoreSource
SWE-bench Verified
All 500 tasks. Can reach 82.0% with high-compute config using parallel attempts and internal scoring model.
77.2%%openai.com β†—
Code Refactoring
Evaluated on refactor tasks from large repos (Python, Go, OCaml). Example: Gitea PR changing 232 files and 3,541 lines.
OpenAI internal evalopenai.com β†—
Code Review Accuracy
Fewer incorrect/unimportant comments than GPT-5 per experienced SWE evaluations on popular open-source repos.
Highly preferred vs GPT-5openai.com β†—

API Usage Examples

Use the global api.therouter.ai endpoint shown below for new integrations; the legacy China accelerated endpoint is retired.

cURL
curl https://api.therouter.ai/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -d '{
    "model": "openai/gpt-5-codex",
    "messages": [
      {"role": "user", "content": "Summarize the key points from this input."}
    ]
  }'

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

More from openai

Similar models

Cross-provider sibling models

News & changes

2026-04-23

OpenAI releases GPT-5.5 with stronger Codex performance

GPT-5.5 matches GPT-5.4 per-token latency while delivering significantly higher intelligence and using fewer tokens per Codex task. Ships with OpenAI's strongest safeguards.

re-authored by TheRouteropenai.com β†—
2026-02-05

OpenAI releases GPT-5.3-Codex system card

GPT-5.3-Codex sets new highs on SWE-Bench Pro and Terminal-Bench. Documents safety evaluations including destructive actions mitigation.

re-authored by TheRouteropenai.com β†—
2025-12-18

OpenAI launches GPT-5.2-Codex with SOTA on agentic coding benchmarks

GPT-5.2-Codex achieves SOTA on SWE-Bench Pro and Terminal-Bench 2.0. Optimized for long-horizon agentic coding and large-scale refactors.

re-authored by TheRouteropenai.com β†—
2025-09-23

OpenAI releases GPT-5-Codex for agentic coding in Codex

GPT-5-Codex announced as a specialized version of GPT-5 for Codex. Available via Responses API at same pricing as GPT-5 ($1.25/$10 per 1M tokens).

re-authored by TheRouteropenai.com β†—

Frequently asked

What is the difference between GPT-5 and GPT-5-Codex?

GPT-5-Codex is a specialized version of GPT-5, purpose-built for agentic coding in OpenAI's Codex environment. It dynamically adjusts reasoning time based on task complexity β€” fewer tokens on simple requests, more reasoning on hard ones. OpenAI recommends it only for coding tasks in Codex or Codex-like environments.

Can I use GPT-5-Codex via TheRouter's API?

Yes. Set model to 'openai/gpt-5-codex' on api.therouter.ai/v1/chat/completions with standard OpenAI SDK. All GPT-5 parameters work: reasoning_effort, verbosity, tools, streaming, structured output.

How does GPT-5-Codex pricing compare to GPT-5?

Identical: $1.25/$10 per 1M tokens, cache_read $0.125. Effective cost per task can be lower because GPT-5-Codex uses fewer tokens on simple requests (93.7% fewer for simplest 10% of turns).

Is GPT-5-Codex good for non-coding tasks?

No. OpenAI explicitly recommends GPT-5-Codex only for agentic coding in Codex-like environments. For general reasoning, use openai/gpt-5.

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