# GPT 5.2 Codex

The GPT-5.2 generation coding agent, bringing GPT-5.2 reasoning and instruction-following improvements to autonomous software engineering workflows.

- **Model ID:** `openai/gpt-5.2-codex`
- **Type:** chat
- **Providers:** azure
- **Context window:** 400,000
- **Maximum output tokens:** 128,000
- **Pricing:** $1.75/1M input tokens, $14/1M output tokens
- **Canonical page:** https://vercel.com/ai-gateway/models/gpt-5.2-codex

## Supported parameters

Detailed capability metadata has not been reported for this model.

## Example

```ts
import { streamText } from 'ai'

const result = streamText({
  model: 'openai/gpt-5.2-codex',
  prompt: 'Why is the sky blue?'
})
```

## About

GPT 5.2 Codex became available on December 18, 2025 on AI Gateway as the GPT-5.2 generation coding agent. It combines GPT-5.2's advances in reasoning depth and instruction following with the specialized coding agent architecture that reads repositories, plans changes, writes code, executes tests, and iterates.

The model handles complex multi-file changes, architectural decisions, and codebase-wide refactoring with GPT-5.2 generation quality. The context window of 400K tokens enables comprehensive repository understanding.

For teams building AI-powered development tools, GPT 5.2 Codex provides GPT-5.2 generation capability in the codex agent architecture.

## What to consider

GPT 5.2 Codex incorporates GPT-5.2 generation improvements for better code comprehension and more reliable autonomous task completion over GPT-5.1 codex.

Like other codex models, it operates in the read-plan-write-execute-verify loop rather than one-shot code generation.

## When to use

### Best For

- **Complex autonomous coding:** Software engineering tasks that benefit from GPT-5.2 generation reasoning
- **Enterprise codebase management:** Large-scale refactoring, migration, and modernization projects
- **Advanced code review:** Deep architectural analysis with GPT-5.2 generation reasoning
- **Complex feature development:** Multi-component features that span services and modules
- **Code quality enforcement:** Comprehensive analysis and improvement of existing codebases

### Consider Alternatives When

- **Routine coding:** Codex mini variants for everyday bug fixes and feature scaffolding
- **Maximum compute:** GPT-5.1 codex max for tasks that benefit from extended reasoning time
- **Non-coding tasks:** Base GPT-5.2 handles general-purpose reasoning and generation outside the read-plan-write-execute-verify codex loop
- **Budget constraints:** Earlier codex generations at lower price points

## Best for

- **Complex autonomous coding:** Software engineering tasks that benefit from GPT-5.2 generation reasoning
- **Enterprise codebase management:** Large-scale refactoring, migration, and modernization projects
- **Advanced code review:** Deep architectural analysis with GPT-5.2 generation reasoning
- **Complex feature development:** Multi-component features that span services and modules
- **Code quality enforcement:** Comprehensive analysis and improvement of existing codebases

## Consider alternatives

- **Routine coding:** Codex mini variants for everyday bug fixes and feature scaffolding
- **Maximum compute:** GPT-5.1 codex max for tasks that benefit from extended reasoning time
- **Non-coding tasks:** Base GPT-5.2 handles general-purpose reasoning and generation outside the read-plan-write-execute-verify codex loop
- **Budget constraints:** Earlier codex generations at lower price points

## Frequently asked questions

### How does GPT 5.2 Codex improve over GPT-5.1 codex?

It incorporates the GPT-5.2 generation's advances in reasoning and instruction following, translating to better code quality and more reliable autonomous task completion.

### What context window does GPT 5.2 Codex support?

400K tokens, enabling comprehensive codebase analysis.

### Can GPT 5.2 Codex run tests and verify its own code?

Yes. It operates in sandboxed environments where it can execute code, run tests, and iterate on solutions.

### How does AI Gateway handle authentication for GPT 5.2 Codex?

AI Gateway accepts a single API key or OIDC token for all requests. You don't embed OpenAI credentials in your application; AI Gateway routes and authenticates on your behalf.

### When should I use an earlier codex model instead?

When cost is a primary concern and the task doesn't require GPT-5.2 generation improvements. Codex mini variants handle routine tasks at a fraction of the cost.

### What are typical latency characteristics?

This page shows live throughput and time-to-first-token metrics measured across real AI Gateway traffic.

## Links

- [Model page](https://vercel.com/ai-gateway/models/gpt-5.2-codex)
- [AI Gateway documentation](https://vercel.com/docs/ai-gateway)
- [Provider model documentation](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service)
- [Provider pricing](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service)
