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

GPT 5.1 Codex

Masukan:$1/M
Keluaran:$8/M
Konteks:400K
Keluaran Maksimum:128K
Dilancarkan: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.

Baru
Penggunaan komersial

Playground untuk GPT 5.1 Codex

Terokai Playground GPT 5.1 Codex โ€” persekitaran interaktif untuk menguji model dan menjalankan pertanyaan dalam masa nyata. Cuba prompt, laraskan parameter, dan ulangi serta-merta untuk mempercepatkan pembangunan dan mengesahkan kes penggunaan.

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

Harga untuk GPT 5.1 Codex

Terokai harga yang kompetitif untuk GPT 5.1 Codex, direka bentuk untuk memenuhi pelbagai bajet dan keperluan penggunaan. Pelan fleksibel kami memastikan anda hanya membayar untuk apa yang anda gunakan, menjadikannya mudah untuk meningkatkan skala apabila keperluan anda berkembang. Temui bagaimana GPT 5.1 Codex boleh meningkatkan projek anda sambil mengekalkan kos yang terurus.

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

Kod contoh dan API untuk 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);

Versi GPT 5.1 Codex

Sebab GPT 5.1 Codex mempunyai berbilang snapshot mungkin merangkumi faktor berpotensi seperti variasi output selepas kemas kini yang memerlukan snapshot lama untuk konsistensi, menyediakan tempoh peralihan untuk penyesuaian dan migrasi kepada pembangun, serta snapshot berbeza yang sepadan dengan endpoint global atau serantau untuk mengoptimumkan pengalaman pengguna. Untuk perbezaan terperinci antara versi, sila rujuk dokumentasi rasmi.

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