GPT-5.1-Codex-Max API

GPT-5.1-Codex-Max on AIMLAPI.

Modalities
Image, TextText
In / Out price
$2.65/$21.16per 1M
Context window
400K tokens
Released
Dec 4, 2025

GPT-5.1-Codex-Max overview

The pelican test: one prompt, every text model, unedited SVG output from Nov 3, 2026.

SVG of a pelican riding a bicycle, written by GPT-5.1-Codex-Max through AI/ML API

GPT-5.1-Codex-Max specs

Model ID
openai/gpt-5.1-codex-max
Developer
OpenAI
Context window
400,000 tokens
Max output
128,000 tokens
Input
Image, Text
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

What is GPT-5.1-Codex-Max API?

Where to Use GPT-5.1-Codex-Max

Coding and code review
Generate, debug, and review code across languages, reading whole files or repos in a single prompt.

Agentic and multi-step workflows
Reliable tool-calling and instruction-following suit agent loops that plan, call tools, and iterate.

Use cases

GPT-5.1-Codex-Max is documented as suited to agentic coding tasks in Codex or Codex-like environments, and OpenAI says it is purpose-built for agentic coding.

It is also documented for PR creation, code review, frontend coding, and Q&A as real-world software engineering tasks it was trained on.

OpenAI’s materials also describe it as trained for autonomous software engineering work more broadly, including long-horizon coding workflows.

The model is additionally described as useful for project-scale refactoring and deep debugging, with support for multi-hour agentic work.

Capabilities

  • Function calling
  • Reasoning
  • Streaming
  • Structured outputs
  • Web search

GPT-5.1-Codex-Max API pricing

GPT-5.1-Codex-Max pricing in US dollars
UsagePriceUnit
Input$2.651M tokens
Output$21.161M tokens
Cached input$0.26451M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

GPT-5.1-Codex-Max vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
GPT-5.1-Codex-Max$2.65$21.16
GPT-6 Luna$0.1$0.5
GPT-6.1 Terra$1$5
GPT-6.1 Sol$2$10
GPT-6.1 Terra Pro$2.12$10.58

How to use the GPT-5.1-Codex-Max API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "openai/gpt-5.1-codex-max",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

GPT-5.1-Codex-Max FAQ

What is the context window of GPT-5.1-Codex-Max?

GPT-5.1-Codex-Max has a 400,000 tokens context window and can return up to 128,000 tokens.

What inputs and outputs does GPT-5.1-Codex-Max support?

GPT-5.1-Codex-Max takes image, text as input and returns text.

What is the model ID for GPT-5.1-Codex-Max?

Use openai/gpt-5.1-codex-max as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.

How much does GPT-5.1-Codex-Max cost?

GPT-5.1-Codex-Max costs $2.65 input and $21.16 output per 1M tokens on AI/ML API, billed as you go with no subscription.

Does GPT-5.1-Codex-Max support streaming?

Yes, GPT-5.1-Codex-Max can stream responses as they are generated.

Can GPT-5.1-Codex-Max read images?

Yes, GPT-5.1-Codex-Max accepts image input alongside text.

Who created GPT-5.1-Codex-Max?

GPT-5.1-Codex-Max was built by OpenAI.

Can GPT-5.1-Codex-Max be accessed through an API?

Yes, it is available via the API endpoint https://api.aimlapi.com/v1/chat/completions.

Start building with GPT-5.1-Codex-Max

GPT-5.1-Codex-Max API

openai/gpt-5.1-codex-max

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "openai/gpt-5.1-codex-max",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'