Back to Models

GPT-5.2-Codex

openaiopenai/gpt-5.2-codex

Intelligent coding model optimized for long-horizon, agentic coding tasks.

GPT-5.2-Codex is OpenAI's most advanced agentic coding model of its generation, released December 18, 2025. It is a version of GPT-5.2 further optimized for agentic coding in Codex, including improvements on long-horizon work through native context compaction, stronger performance on large code changes like refactors and migrations, improved Windows environment performance, and significantly stronger cybersecurity capabilities. The model was the third major capability jump in the Codex family, following GPT-5-Codex and GPT-5.1-Codex-Max.

From a TheRouter operator's perspective, GPT-5.2-Codex is notable for three things. First, its native context compaction via the /responses/compact API enables sustained multi-hour coding sessions without hitting context limits β€” a real production differentiator for large-repo agent workflows. Second, it matches GPT-5.2-Thinking on reasoning benchmarks while adding Codex-specific strengths in terminal-based agentic tasks (64% Terminal-Bench 2.0). Third, it has since been superseded by GPT-5.3-Codex (February 2026), which combines the Codex and GPT-5 reasoning stacks β€” GPT-5.2-Codex remains a cost-effective choice on TheRouter at $1.25/M input tokens with full tool-calling and vision support.

Best for
  • β€’ Long-running, multi-hour agentic coding sessions (refactors, migrations, dependency upgrades) where context compaction keeps the full project state intact
  • β€’ Complex multi-file edits that span large repositories β€” the model maintains continuity across 400K-token context windows without losing track
  • β€’ Windows-native development workflows β€” first Codex model with native Windows environment training and PowerShell understanding
  • β€’ Cybersecurity and vulnerability research β€” strongest cyber model from OpenAI at release; demonstrated capability to discover real-world CVEs (e.g., React Server Components vulnerabilities)
  • β€’ Design-to-prototype workflows β€” vision capabilities allow interpreting screenshots, technical diagrams, and UI mocks to generate functional prototypes
Reach for something else if
  • β€’ Latency-sensitive chat β€” the model is designed for depth and long-horizon reasoning; for sub-second coding completions route to GPT-5.4-mini or GPT-5.2 (instant mode)
  • β€’ Cost-bounded high-volume inference β€” at $1.25 in / $10 out per 1M tokens on TheRouter, lighter models like GPT-5.1-Codex-Mini ($0.25/$2) or DeepSeek V4-Flash offer far better token economics for bulk coding
  • β€’ Tasks that don't need agentic depth β€” for straightforward code gen or simpler Q&A, route to GPT-5.4 or GPT-5.5 which are more cost-effective for non-agentic use
Context Length
400K
Max Output
128K
Input Priceper 1M tokens
$1.89/ 1M tokens
Output Priceper 1M tokens
$15.12/ 1M tokens

Modalities

textimage→text

Capabilities

Vision

Pricing Breakdown

TypeRate
Input$1.89 / 1M tokens
Output$15.12 / 1M tokens

Supported Parameters

temperaturemax_tokenstop_ptoolstool_choiceresponse_formatreasoningstop

Specifications

Release dateDecember 18, 2025openai.com β†—verified
Knowledge cutoffAugust 31, 2025simonwillison.net β†—verified
ArchitectureNot publicly disclosed (proprietary OpenAI transformer)unknown
Context compactionNative support via /responses/compact API β€” loss-aware compression preserving task-relevant informationplatform.openai.com β†—verified
Windows supportNative β€” first Codex model trained for Windows environments with PowerShell understandingopenai.com β†—verified
SuccessorGPT-5.3-Codex (February 5, 2026) β€” combines Codex and GPT-5.2 stacks, 25% fasteropenai.com β†—verified

Benchmarks

BenchmarkDistributionScoreSource
SWE-Bench Pro
State-of-the-art agentic coding benchmark spanning 4 languages β€” GPT-5.2-Codex held SOTA at release (Dec 2025). Resolved by GPT-5.3-Codex (Feb 2026).
56.4%%openai.com β†—
Terminal-Bench 2.0
Tests AI agents in real terminal environments β€” compiling code, training models, setting up servers.
64.0%%openai.com β†—
SWE-Bench Verified (Python)
Python-only SWE-Bench subset. GPT-5-Codex family targets 4-language SWE-Bench Pro as primary benchmark.
~80%%nxcode.io β†—
CVE-Bench
Cybersecurity vulnerability discovery benchmark β€” strongest cyber model from OpenAI at time of release.
87%%nxcode.io β†—
AIME 2025
American Invitational Mathematics Examination 2025 β€” GPT-5.2-Codex matches GPT-5.2-Thinking on reasoning.
100%%digitalapplied.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.2-codex",
    "messages": [
      {"role": "user", "content": "Summarize the key points from this input."}
    ]
  }'

Chat completion

Standard chat completions β€” works with the OpenAI SDK by swapping baseURL to api.therouter.ai/v1. Supports all GPT-5.2-Codex parameters including reasoning_effort, tools, and response_format.

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.2-codex",
    "messages": [
      {"role": "system", "content": "You are an expert software engineer."},
      {"role": "user", "content": "Write a Python function to merge two sorted lists in place."}
    ]
  }'

More from openai

Similar models

Cross-provider sibling models

News & changes

2026-02-05

OpenAI releases GPT-5.3-Codex, successor to GPT-5.2-Codex

GPT-5.3-Codex combines the Codex and GPT-5.2 reasoning stacks into one model, is 25% faster, and sets new SOTA on SWE-Bench Pro and Terminal-Bench. It was the first model OpenAI's own Codex team used to debug and deploy itself.

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

OpenAI launches GPT-5.2-Codex

OpenAI introduced GPT-5.2-Codex as the most advanced agentic coding model, optimized from GPT-5.2 with native context compaction, Windows support, enhanced cybersecurity capabilities, and SOTA on SWE-Bench Pro (56.4%) and Terminal-Bench 2.0 (64.0%).

re-authored by TheRouteropenai.com β†—

Frequently asked

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

GPT-5.2-Codex is a version of GPT-5.2 further optimized for agentic coding within the Codex platform. It adds native context compaction (enabling multi-million-token sessions), native Windows support, enhanced cybersecurity capabilities, and Codex-specific optimizations for long-horizon agentic tasks. On reasoning benchmarks the two models perform similarly, but GPT-5.2-Codex excels on agentic coding benchmarks like SWE-Bench Pro and Terminal-Bench 2.0.

Should I use GPT-5.2-Codex or GPT-5.3-Codex?

GPT-5.3-Codex (released February 2026) is the successor that combines the Codex and GPT-5.2 reasoning stacks. It is 25% faster, achieves higher scores on SWE-Bench Pro and Terminal-Bench, and can do research, tool use, and complex execution beyond pure coding. On TheRouter, GPT-5.3-Codex costs $5 in / $40 out (vs $1.25 / $10 for 5.2-Codex). Choose 5.2-Codex for cost-sensitive coding agent workloads and 5.3-Codex when you need the frontier capability uplift.

Can I use GPT-5.2-Codex through the standard OpenAI SDK on TheRouter?

Yes. GPT-5.2-Codex is fully compatible with the OpenAI SDK β€” just swap the baseURL to https://api.therouter.ai/v1 and use the model ID openai/gpt-5.2-codex. All standard parameters work: chat completions, streaming, tools/function calling, JSON mode, vision, and reasoning_effort. The Codex-specific /responses/compact API endpoint is available through the OpenAI Responses API, not the chat completions SDK.

What cybersecurity capabilities does GPT-5.2-Codex have?

GPT-5.2-Codex was OpenAI's strongest cybersecurity model at release, achieving 87% on CVE-Bench (vulnerability discovery) and demonstrating real-world capability by assisting a researcher in discovering three previously unknown React Server Components vulnerabilities. However, under OpenAI's Preparedness Framework it does not reach the 'High' cybersecurity threshold. The system card outlines additional safeguards including agent sandboxing and configurable network access.

Is GPT-5.2-Codex still available on TheRouter?

Yes, GPT-5.2-Codex remains actively served on TheRouter even though the successor GPT-5.3-Codex is available. Use model ID openai/gpt-5.2-codex. It's a cost-effective choice at $1.25/M input tokens for coding agent workloads, especially when the frontier capabilities of GPT-5.3-Codex aren't needed.

Fact ledger β€” every claim on this page traces here
sourceURLretrieved
Release dateopenai.com β†—2026-05-28verified
Knowledge cutoffsimonwillison.net β†—2026-05-28verified
Architectureβ€”β€”unknown
Context compactionplatform.openai.com β†—2026-05-28verified
Windows supportopenai.com β†—2026-05-28verified
Successoropenai.com β†—2026-05-28verified
SWE-Bench Proopenai.com β†—2026-05-28verified
Terminal-Bench 2.0openai.com β†—2026-05-28verified
SWE-Bench Verified (Python)nxcode.io β†—2026-05-28to verify
CVE-Benchnxcode.io β†—2026-05-28to verify
AIME 2025digitalapplied.com β†—2026-05-28to verify
OpenAI releases GPT-5.3-Codex, successor to GPT-5.2-Codexopenai.com β†—2026-05-28verified
OpenAI launches GPT-5.2-Codexopenai.com β†—2026-05-28verified
What is the difference between GPT-5.2-Codex and GPT-5.2?openai.com β†—2026-05-28to verify
Should I use GPT-5.2-Codex or GPT-5.3-Codex?openai.com β†—2026-05-28to verify
Can I use GPT-5.2-Codex through the standard OpenAI SDK on TheRouter?openai.com β†—2026-05-28to verify
What cybersecurity capabilities does GPT-5.2-Codex have?openai.com β†—2026-05-28to verify
Is GPT-5.2-Codex still available on TheRouter?openai.com β†—2026-05-28to verify
Help & contact