Skip to content
Vercel April 2026 security incident

GPT-5-Codex

openai/gpt-5-codex

GPT-5-Codex is a GPT-5 family model specialized for autonomous software engineering, designed to operate as a coding agent that reads repositories, writes code, executes tests, and iterates on solutions in sandboxed environments.

File InputReasoningTool UseVision (Image)Implicit Caching
index.ts
import { streamText } from 'ai'
const result = streamText({
model: 'openai/gpt-5-codex',
prompt: 'Why is the sky blue?'
})

What To Consider When Choosing a Provider

  • Zero Data Retention

    AI Gateway supports Zero Data Retention for this model via direct gateway requests (BYOK is not included). To configure this, check the documentation.

    Authentication

    AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.

GPT-5-Codex is built for the full coding agent loop rather than one-shot code generation. It reads repository context, plans changes, writes code, runs tests, and iterates until the task is complete.

It brings GPT-5-level reasoning to coding tasks, making it capable of handling complex refactors, architectural decisions, and multi-file changes that require understanding the broader codebase.

When to Use GPT-5-Codex

Best For

  • Autonomous code generation:

    Writing features from specifications with test verification

  • Complex refactoring:

    Multi-file changes that require understanding architectural patterns

  • Bug diagnosis and repair:

    Tracing issues through codebases and producing verified fixes

  • Code review automation:

    Deep analysis of pull requests with actionable suggestions

  • Test generation:

    Creating comprehensive test suites that cover edge cases

Consider Alternatives When

  • Simpler coding tasks:

    Codex mini handles routine bug fixes and feature scaffolding at lower cost

  • General-purpose work:

    Base GPT-5 is better when coding is only part of a broader workflow

  • Non-coding reasoning:

    The o-series reasoning models for pure mathematical or scientific reasoning

  • Chat-based code help:

    GPT-5 chat for conversational coding assistance rather than autonomous execution

Conclusion

GPT-5-Codex combines GPT-5-level reasoning with purpose-built autonomous coding capabilities. For teams building AI-powered development tools on AI Gateway within the GPT-5 generation, it is the coding-specialized option.

FAQ

GPT-5-Codex brings GPT-5-class reasoning to coding tasks, making it better at complex refactors, architectural decisions, and multi-file changes. Codex-mini is optimized for speed and cost on simpler tasks.

Yes. It operates in sandboxed environments where it can run code, execute test suites, and iterate on solutions before returning verified results.

400K tokens, enabling it to read large portions of a codebase in a single pass for comprehensive understanding.

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.

Yes, though its higher cost means it's best reserved for complex tasks. Use codex-mini for routine per-PR checks and GPT-5-Codex for deeper architectural reviews.

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