Skip to content

Commit bef926a

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-828: docs: add openai/gpt-5-2-codex
1 parent c2d1f49 commit bef926a

7 files changed

Lines changed: 239 additions & 2 deletions

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
* [gpt-5.2](api-references/text-models-llm/openai/gpt-5.2.md)
146146
* [gpt-5.2-chat-latest](api-references/text-models-llm/openai/gpt-5.2-chat-latest.md)
147147
* [gpt-5.2-pro](api-references/text-models-llm/openai/gpt-5.2-pro.md)
148+
* [gpt-5.2-codex](api-references/text-models-llm/openai/gpt-5.2-codex.md)
148149
* [Perplexity](api-references/text-models-llm/perplexity/README.md)
149150
* [sonar](api-references/text-models-llm/perplexity/sonar.md)
150151
* [sonar-pro](api-references/text-models-llm/perplexity/sonar-pro.md)

docs/api-references/model-database.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/api-references/text-models-llm/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# gpt-5.2-codex
2+
3+
{% columns %}
4+
{% column width="66.66666666666666%" %}
5+
{% hint style="info" %}
6+
This documentation is valid for the following list of our models:
7+
8+
* `openai/gpt-5-2-codex`
9+
{% endhint %}
10+
{% endcolumn %}
11+
12+
{% column width="33.33333333333334%" %}
13+
<a href="https://aimlapi.com/app/openai/gpt-5-2-codex" class="button primary">Try in Playground</a>
14+
{% endcolumn %}
15+
{% endcolumns %}
16+
17+
## Model Overview
18+
19+
A specialized edition of [GPT 5.2](gpt-5.2.md) built for software engineering and coding workflows. It excels in both interactive development sessions and long, autonomous execution of complex engineering tasks. The model can build projects from scratch, develop features, debug, perform large-scale refactoring, and review code.
20+
21+
## How to Make a Call
22+
23+
<details>
24+
25+
<summary>Step-by-Step Instructions</summary>
26+
27+
:digit\_one: **Setup You Can’t Skip**
28+
29+
:black\_small\_square: [**Create an Account**](https://aimlapi.com/app/sign-up): Visit the AI/ML API website and create an account (if you don’t have one yet).\
30+
:black\_small\_square: [**Generate an API Key**](https://aimlapi.com/app/keys): After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.
31+
32+
:digit\_two: **Copy the code example**
33+
34+
At the bottom of this page, you'll find [a code example](gpt-5.2-codex.md#code-example-using-responses-endpoint) that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.
35+
36+
:digit\_three: **Modify the code example**
37+
38+
:black\_small\_square: Replace `<YOUR_AIMLAPI_KEY>` with your actual AI/ML API key from your account.\
39+
:black\_small\_square: Insert your question or request into the `content` field—this is what the model will respond to.
40+
41+
:digit\_four: <sup><sub><mark style="background-color:yellow;">**(Optional)**<mark style="background-color:yellow;"><sub></sup>**&#x20;Adjust other optional parameters if needed**
42+
43+
Only `model` and `messages` are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding [API schema](gpt-5.2-codex.md#api-schema), which lists all available parameters along with notes on how to use them.
44+
45+
:digit\_five: **Run your modified code**
46+
47+
Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.
48+
49+
{% hint style="success" %}
50+
If you need a more detailed walkthrough for setting up your development environment and making a request step by step — feel free to use our [Quickstart guide](../../../quickstart/setting-up.md).
51+
{% endhint %}
52+
53+
</details>
54+
55+
## API Schema
56+
57+
<details>
58+
59+
<summary>Chat Completions vs. Responses API</summary>
60+
61+
**Chat Completions**\
62+
The _chat completions_ API is the older, chat-oriented interface where you send a list of messages (`role: user`, `role: assistant`, etc.), and the model returns a single response. It was designed specifically for conversational workflows and follows a structured chat message format. It is now considered a legacy interface.
63+
64+
**Responses**\
65+
The _Responses_ API is the newer, unified interface used across OpenAI’s latest models. Instead of focusing only on chat, it supports multiple input types (text, images, audio, tools, etc.) and multiple output modalities (text, JSON, images, audio, video). It is more flexible, more consistent across models, and intended to replace chat completions entirely.
66+
67+
</details>
68+
69+
### Responses Endpoint
70+
71+
This endpoint is currently used _only_ with OpenAI models. Some models support both the `/chat/completions` and `/responses` endpoints, while others support only one of them.
72+
73+
{% hint style="warning" %}
74+
Note: This model can ONLY be called via the `/responses` endpoint!
75+
{% endhint %}
76+
77+
{% openapi-operation spec="gpt-5-2-codex-RESPONSES" path="/v1/responses" method="post" %}
78+
[OpenAPI gpt-5-2-codex-RESPONSES](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/text-models-llm/OpenAI/gpt-5-2-codex-RESPONSES.json)
79+
{% endopenapi-operation %}
80+
81+
## Code Example: Using /responses Endpoint
82+
83+
{% tabs %}
84+
{% tab title="Python" %}
85+
{% code overflow="wrap" %}
86+
```python
87+
import requests
88+
import json # for getting a structured output with indentation
89+
90+
response = requests.post(
91+
"https://api.aimlapi.com/v1/responses",
92+
headers={
93+
"Content-Type":"application/json",
94+
95+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
96+
"Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
97+
"Content-Type":"application/json"
98+
},
99+
json={
100+
"model":"openai/gpt-5-2-codex",
101+
"input":"Hello" # Insert your question for the model here, instead of Hello
102+
}
103+
)
104+
105+
data = response.json()
106+
print(json.dumps(data, indent=2, ensure_ascii=False))
107+
```
108+
{% endcode %}
109+
{% endtab %}
110+
111+
{% tab title="JavaScript" %}
112+
{% code overflow="wrap" %}
113+
```javascript
114+
async function main() {
115+
try {
116+
const response = await fetch('https://api.aimlapi.com/v1/responses', {
117+
method: 'POST',
118+
headers: {
119+
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
120+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
121+
'Content-Type': 'application/json',
122+
},
123+
body: JSON.stringify({
124+
model: 'openai/gpt-5-2-codex',
125+
input: 'Hello', // Insert your question here, instead of Hello
126+
}),
127+
});
128+
129+
if (!response.ok) {
130+
throw new Error(`HTTP error! Status ${response.status}`);
131+
}
132+
133+
const data = await response.json();
134+
console.log(JSON.stringify(data, null, 2));
135+
136+
} catch (error) {
137+
console.error('Error', error);
138+
}
139+
}
140+
141+
main();
142+
```
143+
{% endcode %}
144+
{% endtab %}
145+
{% endtabs %}
146+
147+
<details>
148+
149+
<summary>Response</summary>
150+
151+
{% code overflow="wrap" %}
152+
```json5
153+
{
154+
"id": "9GEwjd_Z2_KEtQZARClau",
155+
"object": "response",
156+
"created_at": 1769503536,
157+
"status": "completed",
158+
"background": false,
159+
"billing": {
160+
"payer": "developer"
161+
},
162+
"completed_at": 1769503538,
163+
"error": null,
164+
"frequency_penalty": 0,
165+
"incomplete_details": null,
166+
"instructions": null,
167+
"max_output_tokens": null,
168+
"max_tool_calls": null,
169+
"model": "gpt-5.2-codex",
170+
"output": [
171+
{
172+
"id": "rs_0fb4c0cd166661bd0069787b3143dc8197bb5e5cf796d2be25",
173+
"type": "reasoning",
174+
"summary": []
175+
},
176+
{
177+
"id": "msg_0fb4c0cd166661bd0069787b31ce4c81979aedccb49fa3a181",
178+
"type": "message",
179+
"status": "completed",
180+
"content": [
181+
{
182+
"type": "output_text",
183+
"annotations": [],
184+
"logprobs": [],
185+
"text": "Hello! How can I help you today?"
186+
}
187+
],
188+
"role": "assistant"
189+
}
190+
],
191+
"parallel_tool_calls": true,
192+
"presence_penalty": 0,
193+
"previous_response_id": null,
194+
"prompt_cache_key": null,
195+
"prompt_cache_retention": null,
196+
"reasoning": {
197+
"effort": "medium",
198+
"summary": null
199+
},
200+
"safety_identifier": null,
201+
"service_tier": "default",
202+
"store": true,
203+
"temperature": 1,
204+
"text": {
205+
"format": {
206+
"type": "text"
207+
},
208+
"verbosity": "medium"
209+
},
210+
"tool_choice": "auto",
211+
"tools": [],
212+
"top_logprobs": 0,
213+
"top_p": 0.98,
214+
"truncation": "disabled",
215+
"usage": {
216+
"input_tokens": 7,
217+
"input_tokens_details": {
218+
"cached_tokens": 0
219+
},
220+
"output_tokens": 38,
221+
"output_tokens_details": {
222+
"reasoning_tokens": 0
223+
},
224+
"total_tokens": 45
225+
},
226+
"user": null,
227+
"metadata": {},
228+
"output_text": "Hello! How can I help you today?"
229+
}
230+
```
231+
{% endcode %}
232+
233+
</details>

docs/capabilities/code-generation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Let's go over this again: any [text chat model](../api-references/model-database
4242
* [​openai/gpt-5-1-codex-mini](../api-references/text-models-llm/openai/gpt-5-1-codex-mini.md)
4343
* [openai/gpt-5-2](../api-references/text-models-llm/openai/gpt-5.2.md)
4444
* [openai/gpt-5-2-chat-latest](../api-references/text-models-llm/openai/gpt-5.2-chat-latest.md)
45+
* [openai/gpt-5-2-codex](../api-references/text-models-llm/openai/gpt-5.2-codex.md)
4546
* [x-ai/grok-code-fast-1](../api-references/text-models-llm/xai/grok-code-fast-1.md)
4647
* [zhipu/glm-4.5-air](../api-references/text-models-llm/zhipu/glm-4.5-air.md)
4748
* [zhipu/glm-4.5](../api-references/text-models-llm/zhipu/glm-4.5.md)

docs/capabilities/function-calling.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ print(json.dumps(response.choices[0].message.model_dump()['tool_calls'], indent=
182182
* [openai/gpt-5-1-codex-mini](../api-references/text-models-llm/openai/gpt-5-1-codex-mini.md)
183183
* [openai/gpt-5-2](../api-references/text-models-llm/openai/gpt-5.2.md)
184184
* [openai/gpt-5-2-chat-latest](../api-references/text-models-llm/openai/gpt-5.2-chat-latest.md)
185+
* [openai/gpt-5-2-codex](../api-references/text-models-llm/openai/gpt-5.2-codex.md)
185186

186187
***
187188

docs/capabilities/image-to-text-vision.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ print(response.json())
9292
* [​openai/gpt-5-1-codex-mini](../api-references/text-models-llm/openai/gpt-5-1-codex-mini.md)
9393
* [openai/gpt-5-2](../api-references/text-models-llm/openai/gpt-5.2.md)
9494
* [openai/gpt-5-2-chat-latest](../api-references/text-models-llm/openai/gpt-5.2-chat-latest.md)
95+
* [openai/gpt-5-2-codex](../api-references/text-models-llm/openai/gpt-5.2-codex.md)
9596
* [perplexity/sonar](../api-references/text-models-llm/perplexity/sonar.md)
9697
* [perplexity/sonar-pro](../api-references/text-models-llm/perplexity/sonar-pro.md)
9798
* [x-ai/grok-4-fast-non-reasoning](../api-references/text-models-llm/xai/grok-4-fast-non-reasoning.md)

0 commit comments

Comments
 (0)