---
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/openai/openai-gpt-5.2-codex/api.md
canonical: https://modelslab.com/models/openai/openai-gpt-5.2-codex/api.md
type: product
component: Playground/LLM/Index
generated_at: 2026-04-15T02:04:09.302692Z
---

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 openai Closed Source Model $7.875000 / call

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)

[NN](https://modelslab.com/models/together_ai/nvidia-NVIDIA-Nemotron-Nano-9B-v2)[Together AI](https://modelslab.com/models/together_ai)

 [Nvidia Nemotron Nano 9B V2

Closed Source Model](https://modelslab.com/models/together_ai/nvidia-NVIDIA-Nemotron-Nano-9B-v2)

[QQ](https://modelslab.com/models/open_router/qwen-qwen3-coder)[Open Router](https://modelslab.com/models/open_router)

 [Qwen: Qwen3 Coder 480B A35B

Closed Source Model](https://modelslab.com/models/open_router/qwen-qwen3-coder)

[XG](https://modelslab.com/models/open_router/x-ai-grok-4.20)[Open Router](https://modelslab.com/models/open_router)

 [xAI: Grok 4.20

Closed Source Model](https://modelslab.com/models/open_router/x-ai-grok-4.20)

[ML](https://modelslab.com/models/meta/meta-llama-Meta-Llama-3-70B-Instruct-Turbo)[ModelsLab](https://modelslab.com/models/meta)

 [Meta Llama 3 70B Instruct Turbo

Closed Source Model](https://modelslab.com/models/meta/meta-llama-Meta-Llama-3-70B-Instruct-Turbo)

[OG](https://modelslab.com/models/open_router/openai-gpt-5.1)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-5.1

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-5.1)

[AC](https://modelslab.com/models/open_router/anthropic-claude-opus-4)[Open Router](https://modelslab.com/models/open_router)

 [Anthropic: Claude Opus 4

Closed Source Model](https://modelslab.com/models/open_router/anthropic-claude-opus-4)

[OG](https://modelslab.com/models/open_router/openai-gpt-4o-2024-11-20)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-4o (2024-11-20)

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-4o-2024-11-20)

[ZG](https://modelslab.com/models/open_router/z-ai-glm-4.7)[Open Router](https://modelslab.com/models/open_router)

 [Z.ai: GLM 4.7

Closed Source Model](https://modelslab.com/models/open_router/z-ai-glm-4.7)

[CC](https://modelslab.com/models/open_router/cohere-command-r7b-12-2024)[Open Router](https://modelslab.com/models/open_router)

 [Cohere: Command R7B (12-2024)

Closed Source Model](https://modelslab.com/models/open_router/cohere-command-r7b-12-2024)

[![Anthropic: Claude Haiku 4.5](https://images.stablediffusionapi.com/?Image=https://assets.modelslab.ai/generations/b89d0017-305c-42f8-8327-14107b3de1a0.png)](https://modelslab.com/models/open_router/anthropic-claude-haiku-4.5)[Open Router](https://modelslab.com/models/open_router)

 [Anthropic: Claude Haiku 4.5

Closed Source Model](https://modelslab.com/models/open_router/anthropic-claude-haiku-4.5)

[MM](https://modelslab.com/models/open_router/mistralai-mistral-small-24b-instruct-2501)[Open Router](https://modelslab.com/models/open_router)

 [Mistral: Mistral Small 3

Closed Source Model](https://modelslab.com/models/open_router/mistralai-mistral-small-24b-instruct-2501)

[MW](https://modelslab.com/models/open_router/mancer-weaver)[Open Router](https://modelslab.com/models/open_router)

 [Mancer: Weaver (alpha)

Closed Source Model](https://modelslab.com/models/open_router/mancer-weaver)

[OG](https://modelslab.com/models/open_router/openai-gpt-4-turbo)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-4 Turbo

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-4-turbo)

[NN](https://modelslab.com/models/open_router/nvidia-nemotron-3-nano-30b-a3b)[Open Router](https://modelslab.com/models/open_router)

 [NVIDIA: Nemotron 3 Nano 30B A3B

Closed Source Model](https://modelslab.com/models/open_router/nvidia-nemotron-3-nano-30b-a3b)

[DV](https://modelslab.com/models/together_ai/deepseek-ai-DeepSeek-V3.1)[Together AI](https://modelslab.com/models/together_ai)

 [Deepseek V3.1

Closed Source Model](https://modelslab.com/models/together_ai/deepseek-ai-DeepSeek-V3.1)

[QQ](https://modelslab.com/models/open_router/qwen-qwen3-max-thinking)[Open Router](https://modelslab.com/models/open_router)

 [Qwen: Qwen3 Max Thinking

Closed Source Model](https://modelslab.com/models/open_router/qwen-qwen3-max-thinking)

[Q7](https://modelslab.com/models/qwen/Qwen-Qwen2.5-72B-Instruct-Turbo)[ModelsLab](https://modelslab.com/models/qwen)

 [Qwen2.5 72B Instruct Turbo

Closed Source Model](https://modelslab.com/models/qwen/Qwen-Qwen2.5-72B-Instruct-Turbo)

[BE](https://modelslab.com/models/open_router/baidu-ernie-4.5-300b-a47b)[Open Router](https://modelslab.com/models/open_router)

 [Baidu: ERNIE 4.5 300B A47B

Closed Source Model](https://modelslab.com/models/open_router/baidu-ernie-4.5-300b-a47b)

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-codexCategoryLLM ModelsTaskText GenerationPrice$7.875000 per million tokensAddedFebruary 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>
```

View the [full API documentation](https://modelslab.com/models/openai/openai-gpt-5.2-codex/api) for SDKs, code examples in Python, JavaScript, and more.

### 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-04-15*