---
title: OpenAI: GPT 5.2 Codex API | Text Generation | ModelsLab
description: Advanced GPT-5.2-Codex LLM excels in agentic coding with 400K context, multimodal text/image inputs, and top SWE-Bench scores for refactoring.
url: https://modelslab.com/models/modelslab/openai-gpt-5.2-codex.md
canonical: https://modelslab.com/models/modelslab/openai-gpt-5.2-codex.md
type: product
component: Playground/LLM/Index
generated_at: 2026-06-24T13:02:08.042147Z
---

OpenAI: GPT-5.2-Codex
---

 [LLMs.txt](https://modelslab.com/models/open_router/openai-gpt-5.2-codex/llms.txt) [.md](https://modelslab.com/models/openai/openai-gpt-5.2-codex.md)

OpenAI: GPT-5.2-Codex
---

Choose a prompt below to get started or type your own message

 Explain quantum computing in simple terms

 Write a Python function to sort a list

 Create a marketing email for a SaaS product

 Compare REST vs GraphQL APIs

Send

### OpenAI: GPT-5.2-Codex

openai openai-gpt-5.2-codex

Copy model ID

PricingInput $1.75 / 1M tokens

Output $14.00 / 1M tokens

API EndpointsOpenAI Compatible

`https://modelslab.com/api/v7/llm/chat/completions`Endpoint

Anthropic Compatible

`https://modelslab.com/api/v7/llm/v1/messages`Messages

`https://modelslab.com/api/v7/llm/v1/messages/count_tokens`Count Tokens

`https://modelslab.com/api/v7/llm/v1/models`Models

Use with Claude Code

cURL Example

ParametersSystem MessageYou are a helpful AI assistant specialized in providing accurate and detailed responses.

Temperature0.7

Max Tokens1000

Top P0.9

Frequency Penalty0

Presence Penalty0

Model Info

Support

Related Models
---

Discover similar models you might be interested in

 [View all LLM Models](https://modelslab.com/models?feature=llmaster)

[#### open\_router/Meta: Llama 3.1 70B Instruct

meta-llama-llama-3.1-70b-instruct

From $0.40/M tokens](https://modelslab.com/models/open_router/meta-llama-llama-3.1-70b-instruct)

[#### open\_router/Qwen: Qwen3 VL 30B A3B Thinking

qwen-qwen3-vl-30b-a3b-thinking

From $0.84/M tokens](https://modelslab.com/models/open_router/qwen-qwen3-vl-30b-a3b-thinking)

[#### open\_router/Morph: Morph V3 Large

morph-morph-v3-large

From $1.40/M tokens](https://modelslab.com/models/open_router/morph-morph-v3-large)

[#### open\_router/Amazon: Nova Micro 1.0

amazon-nova-micro-v1

From $0.09/M tokens](https://modelslab.com/models/open_router/amazon-nova-micro-v1)

[#### open\_router/Google: Gemini 2.5 Pro

google-gemini-2.5-pro

From $5.63/M tokens](https://modelslab.com/models/open_router/google-gemini-2.5-pro)

[#### open\_router/MoonshotAI: Kimi K2.5

moonshotai-kimi-k2.5

From $1.20/M tokens](https://modelslab.com/models/open_router/moonshotai-kimi-k2.5)

[#### open\_router/Meta: Llama 3.3 70B Instruct

meta-llama-llama-3.3-70b-instruct

From $0.21/M tokens](https://modelslab.com/models/open_router/meta-llama-llama-3.3-70b-instruct)

[#### arcee\_ai/Arcee AI Coder-Large

arcee-ai-coder-large

From $0.65/M tokens](https://modelslab.com/models/arcee_ai/arcee-ai-coder-large)

[#### open\_router/Nex AGI: Nex-N2-Pro

nex-agi-nex-n2-pro

From $0.63/M tokens](https://modelslab.com/models/open_router/nex-agi-nex-n2-pro)

[#### open\_router/Poolside: Laguna XS.2

poolside-laguna-xs.2

From $0.15/M tokens](https://modelslab.com/models/open_router/poolside-laguna-xs.2)

[#### open\_router/Xiaomi: MiMo-V2.5-Pro

xiaomi-mimo-v2.5-pro

From $0.65/M tokens](https://modelslab.com/models/open_router/xiaomi-mimo-v2.5-pro)

[#### meta/Llama 3.1 Nemotron 70B Instruct HF

nvidia-Llama-3.1-Nemotron-70B-Instruct-HF

From $0.88/M tokens](https://modelslab.com/models/meta/nvidia-Llama-3.1-Nemotron-70B-Instruct-HF)

[#### meta/Meta Llama 3.1 8B Instruct Turbo

meta-llama-Meta-Llama-3.1-8B-Instruct-Turbo

From $0.18/M tokens](https://modelslab.com/models/meta/meta-llama-Meta-Llama-3.1-8B-Instruct-Turbo)

[#### open\_router/Kwaipilot: KAT-Coder-Pro V2

kwaipilot-kat-coder-pro-v2

From $0.75/M tokens](https://modelslab.com/models/open_router/kwaipilot-kat-coder-pro-v2)

[#### open\_router/OpenAI: gpt-oss-safeguard-20b

openai-gpt-oss-safeguard-20b

From $0.19/M tokens](https://modelslab.com/models/open_router/openai-gpt-oss-safeguard-20b)

[#### open\_router/OpenAI: GPT-4o-mini (2024-07-18)

openai-gpt-4o-mini-2024-07-18

From $0.38/M tokens](https://modelslab.com/models/open_router/openai-gpt-4o-mini-2024-07-18)

[#### deepseek/DeepSeek R1 Distill Qwen 14B

deepseek-ai-DeepSeek-R1-Distill-Qwen-14B

From $1.60/M tokens](https://modelslab.com/models/deepseek/deepseek-ai-DeepSeek-R1-Distill-Qwen-14B)

[#### google/Gemini 2.5 Flash Image Preview 

gemini-2.5-flash-image-preview

From $1.40/M tokens](https://modelslab.com/models/google/gemini-2.5-flash-image-preview)

Open Source Alternatives
---

Explore open-source models that offer similar capabilities with full transparency and flexibility

 [View all open source models](https://modelslab.com/models?feature=llm&provider=open-source-models)

[MU

Popular](https://modelslab.com/models/modelslab/uncensored-chat)[ModelsLab](https://modelslab.com/models/modelslab)

 [Modelslab: Uncensored Chat

Open Source Model](https://modelslab.com/models/modelslab/uncensored-chat)

About OpenAI: GPT-5.2-Codex
---

GPT-5.2-Codex is an upgraded version of GPT-5.1-Codex optimized for software engineering and coding workflows. It is designed for both interactive development sessions and long, independent execution of complex engineering tasks....

### Technical Specifications

Model IDopenai-gpt-5.2-codex

CategoryLLM Models

TaskText Generation

Price$7.875 per million tokens

AddedFebruary 20, 2026

### Key Features

- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output

### Quick Start

Integrate OpenAI: GPT-5.2-Codex into your application with a single API call. Get your API key from the [pricing page](https://modelslab.com/pricing) to get started.

PythonJavaScriptcURLPHP

```
<code>import requests
import json

url = "https://modelslab.com/api/v7/llm/chat/completions"

headers = {
    "Content-Type": "application/json"
}

data = {
        "model_id": "openai-gpt-5.2-codex",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
        "max_tokens": 1000,
        "key": "YOUR_API_KEY"
    }

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises an HTTPError for bad responses (4XX or 5XX)
    result = response.json()
    print("API Response:")
    print(json.dumps(result, indent=2))
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except Exception as err:
    print(f"Other error occurred: {err}")</code>
```

### Pricing

OpenAI: GPT-5.2-Codex API costs $7.875000 per million tokens. Pay only for what you use with no minimum commitments. [View pricing plans](https://modelslab.com/pricing)

### Use Cases

- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction

[Browse LLM Models](https://modelslab.com/models?feature=llmaster) [More from Openai](https://modelslab.com/models/open_router) [View Pricing](https://modelslab.com/pricing)

OpenAI: GPT-5.2-Codex FAQ
---

### What is OpenAI: GPT-5.2-Codex?

GPT-5.2-Codex is an upgraded version of GPT-5.1-Codex optimized for software engineering and coding workflows. It is designed for both interactive development sessions and long, independent execution of complex engineering tasks....

### How do I use the OpenAI: GPT-5.2-Codex API?

You can integrate OpenAI: GPT-5.2-Codex into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "openai-gpt-5.2-codex" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.

### How much does OpenAI: GPT-5.2-Codex cost?

OpenAI: GPT-5.2-Codex costs $7.875000 per million tokens. ModelsLab uses pay-per-use pricing with no minimum commitments. A free tier is available to get started.

### What is the OpenAI: GPT-5.2-Codex model ID?

The model ID for OpenAI: GPT-5.2-Codex is "openai-gpt-5.2-codex". Use this ID in your API requests to specify this model.

### Does OpenAI: GPT-5.2-Codex have a free tier?

Yes, ModelsLab offers a free tier that lets you try OpenAI: GPT-5.2-Codex and other AI models. Sign up to get free API credits and start building immediately.

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-06-24*