Unlock exclusive introductory pricing for the newly launched Gemini 3.5 Flash.
O

GPT 5.1 Codex

Ingresso:$1/M
Uscita:$8/M
Contesto:400K
Uscita Massima:128K
Rilasciato:Nov 13, 2025

GPT-5.1-Codex is a high-performance large language model focused on code generation and understanding, with enhanced capabilities for complex programming tasks, code reasoning, and production-level applications.

Nuovo
Uso commerciale

Playground per GPT 5.1 Codex

Esplora il Playground di GPT 5.1 Codex โ€” un ambiente interattivo per testare modelli ed eseguire query in tempo reale. Prova prompt, regola parametri e itera istantaneamente per accelerare lo sviluppo e convalidare i casi d'uso.

What is the GPT-5.1-Codex ?

gpt-5.1-codex is a specialized member of OpenAIโ€™s GPT-5.1 family, optimized for agentic, long-running software-engineering workflows (code generation, patching, large refactors, structured code review and multi-step agentic tasks).

Features

  • Agentic tooling first โ€” built to emit structured patch operations and shell calls (the model can produce apply_patch_call and shell_call items which your integration executes and returns outputs for). This enables reliable create/update/delete operations across files.
  • Responses API only โ€” Codex variants in the 5.1 line are available only via the Responses API and are tuned for tool-driven workflows rather than conversational chat flows.
  • Adaptive reasoning and latency modes โ€” GPT-5.1 family introduces reasoning_effort (including a none mode for latency-sensitive interactions) and extended prompt caching (up to 24h) to improve interactive coding sessions. Codex models emphasize efficient iterative work.
  • Steerability and code personality โ€” tuned to be more โ€œdeliberateโ€ for fewer wasted actions in long sessions and to produce clearer update messages for PRs and patch diffs.
  • Codex-specific UX: IDE/CLI default model setting, session resume, context compaction, image/screenshot inputs for frontend tasks in Codex Web.

Technical details & operational considerations

  • API surface: gpt-5.1-codex is served via the Responses API (not Chat Completions). The Responses API supports tool calling, structured outputs, streaming, and the apply_patch and shell tools that Codex leverages.
  • Tool calling semantics: include tools in the request (tools: ). The model may emit apply_patch_call or shell_call items; your code executes the patch/command and returns outputs back to the model in the follow-up request. The Responses API is agentic by default so it can orchestrate multi-step plans.
  • Reasoning tuning: use reasoning={"effort":"none"} (Responses API) for minimal thinking/low latency, or {"effort":"medium"}/high for thorough code reasoning and validation. Note that none improves parallel tool-calling and latency-sensitive code edits.
  • Session persistence / context: Codex and the Responses API support session resume and context compaction to summarize older context as you approach the context limit, enabling extended interactive sessions without manual context trimming.
  • Interactive IDE workflows: intelligent code completion, PR drafting, inline patching and multi-turn code edits.
  • Agentic automation: long-running agent tasks that require applying a sequence of patches, running shell steps, and validating via tests.
  • Code review & refactoring: higher-quality diffs and structured review comments (SWE-bench improvements reported by partners).
  • Test generation & validation: generate unit/integration tests, run them via a controlled shell tool, iterate on failures.

How to use GPT-5.1 Codex API

Required Steps

  • Log in to cometapi.com. If you are not our user yet, please register first.
  • Sign into your CometAPI console.
  • Get the access credential API key of the interface. Click โ€œAdd Tokenโ€ at the API token in the personal center, get the token key: sk-xxxxx and submit.

Use Method

  1. Select the โ€œgpt-5.1-codexโ€ endpoint to send the API request and set the request body. The request method and request body are obtained from our website API doc. Our website also provides Apifox test for your convenience.
  2. Replace <YOUR_API_KEY> with your actual CometAPI key from your account.
  3. Insert your question or request into the content fieldโ€”this is what the model will respond to.
  4. . Process the API response to get the generated answer.

CometAPI provides a fully compatible REST APIโ€”for seamless migration. Key details to Responses

See also GPT-5.1 API and GPT-5.1-Chat-latest API

Prezzi per GPT 5.1 Codex

Esplora i prezzi competitivi per GPT 5.1 Codex, progettato per adattarsi a vari budget e necessitร  di utilizzo. I nostri piani flessibili garantiscono che paghi solo per quello che usi, rendendo facile scalare man mano che i tuoi requisiti crescono. Scopri come GPT 5.1 Codex puรฒ migliorare i tuoi progetti mantenendo i costi gestibili.

ModelComet Price (USD / M Tokens)Official Price (USD / M Tokens)Discount
gpt-5.1-codex
Ingresso:$1/M
Uscita:$8/M
Ingresso:$1.25/M
Uscita:$10/M
-20%
gpt-5.1-codex-max
Ingresso:$1/M
Uscita:$8/M
Ingresso:$1.25/M
Uscita:$10/M
-20%

Codice di esempio e API per GPT 5.1 Codex

gpt-5.1-codex is a specialized member of OpenAIโ€™s GPT-5.1 family, optimized for agentic, long-running software-engineering workflows (code generation, patching, large refactors, structured code review and multi-step agentic tasks).

curl https://api.cometapi.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "gpt-5.1-codex",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }'

cURL Code Example

curl https://api.cometapi.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "gpt-5.1-codex",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }'

JavaScript Code Example

import OpenAI from "openai";

// Get your CometAPI key from https://api.cometapi.com/console/token, and paste it here
const api_key = process.env.COMETAPI_KEY;
const base_url = "https://api.cometapi.com/v1";

const openai = new OpenAI({
  apiKey: api_key,
  baseURL: base_url,
});

const response = await openai.responses.create({
  model: "gpt-5.1-codex",
  input: "Tell me a three sentence bedtime story about a unicorn.",
});

console.log(response);

Versioni di GPT 5.1 Codex

Il motivo per cui GPT 5.1 Codex dispone di piรน snapshot puรฒ includere fattori potenziali come variazioni nell'output dopo aggiornamenti che richiedono snapshot precedenti per coerenza, offrire agli sviluppatori un periodo di transizione per l'adattamento e la migrazione, e diversi snapshot corrispondenti a endpoint globali o regionali per ottimizzare l'esperienza utente. Per le differenze dettagliate tra le versioni, si prega di fare riferimento alla documentazione ufficiale.

Version
gpt-5.1-codex
gpt-5.1-codex-max