Source code files
AI Models & Assistants / Knowledge library
GPT-5.1-Codex-Max
A version of GPT-5.1-codex optimized for long running tasks.
Why learn GPT-5.1-Codex-Max?
Offers the documented OpenAI model capabilities through hosted.
The problem it solves
Provides model inference for supported text / image inputs.
Where it came from
GPT-5.1-Codex-Max: A version of GPT-5.1-codex optimized for long running tasks. Published aliases: gpt-5.1-codex-max. Input: text, image. Output: text. Checked 2026-10-13. Model capabilities are distinct from tools available in a particular agent.
Build your understanding
Work through these exercises in order. Try the task before opening a reference.
- Explain what GPT-5.1-Codex-Max does.
- Identify a use case for GPT-5.1-Codex-Max.
- Describe a limitation of GPT-5.1-Codex-Max.
- Name a compatible tool for GPT-5.1-Codex-Max.
- Compare GPT-5.1-Codex-Max against an alternative.
Documentation and sources
- Primary source / model card (developers.openai.com)
Catalog research notes
- See the AI Workbench for source dates, pricing evidence and configuration details.
Connect the ideas
Built on
Real World Example
Automated Legacy System Refactoring
Enterprise software maintenance teams managing monolithic codebases.
The business problem
Manual refactoring of legacy modules often leads to regression errors and inconsistent architectural patterns due to the sheer scale of the codebase.
How this topic solves it
GPT-5.1-Codex-Max provides a high-capacity agentic environment via the Responses API, allowing the model to maintain deep context across massive file structures to perform systematic, multi-step refactoring tasks.
- Initialize a session using the Responses API to establish a persistent context for the codebase.
- Upload the legacy module architecture as structured input to leverage the 400,000 token context window.
- Define refactoring rules using function calling to ensure the model adheres to modern design patterns.
- Execute the refactoring process in stages, utilizing the model's reasoning capabilities to validate dependencies.
- Review the generated output stream to verify compliance with the target architectural standards.
This diagram illustrates the flow of data from the legacy codebase into the specialized API for processing.
GPT-5.1-Codex-Max interface
Updated code output
- Legacy Repository → Ingests codebase context → Responses API
- Responses API → Streams refactored code → Refactored Module
Implementation example
This demonstrates the required use of the Responses API endpoint, which is the only supported interface for GPT-5.1-Codex-Max.
# Using the Responses API for long-running refactoring
response = client.responses.create(
model="gpt-5.1-codex-max",
input=legacy_code_context, # Large context window allows full module ingestion
tools=[refactor_function_definition] # Enforces architectural constraints
)Expected business outcome
A more maintainable, modular codebase with reduced technical debt and improved consistency across legacy components.
Limitations and checks
The model's reliance on the Responses API means it is not compatible with standard Chat Completions workflows, requiring developers to re-architect their integration layer to handle asynchronous response streams.