GPT-5.1-Codex
GPT-5.1-Codex is a GPT-5.1 generation coding agent model designed for autonomous software engineering, combining improved reasoning over the GPT-5 codex generation with the ability to read, write, execute, and verify code in sandboxed environments.
import { streamText } from 'ai'
const result = streamText({ model: 'openai/gpt-5.1-codex', prompt: 'Why is the sky blue?'})Frequently Asked Questions
How does GPT-5.1-Codex improve over GPT-5 codex?
It benefits from the GPT-5.1 generation's advances in reasoning and instruction following, producing better code quality and more reliable autonomous task completion.
When should I use codex max instead?
When tackling the most complex coding challenges where maximum compute and reasoning depth are worth the additional cost, such as large-scale architectural changes or critical security audits.
What context window does GPT-5.1-Codex support?
400K tokens, enabling comprehensive codebase understanding in a single pass.
Can GPT-5.1-Codex run tests?
Yes. It operates in sandboxed environments where it can execute code and run test suites to verify its output.
How does AI Gateway handle authentication for GPT-5.1-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.
What are typical latency characteristics?
This page shows live throughput and time-to-first-token metrics measured across real AI Gateway traffic.