1# Code generation1# Code generation
2 2
3Writing, reviewing, editing, and answering questions about code is one of the primary use cases for OpenAI models today. This guide walks through your options for code generation with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and Codex.3Writing, reviewing, editing, and answering questions about code is one of the primary use cases for OpenAI models today. This guide walks through your options for code generation with [`gpt-5.6`](https://developers.openai.com/api/docs/models/gpt-5.6-sol) and Codex.
4 4
5## Get started5## Get started
6 6
11 11
12[**Codex**](https://developers.openai.com/codex/overview) is OpenAI's coding agent for software development. It helps you write, review and debug code. Interact with Codex in a variety of interfaces: in your IDE, through the CLI, on web and mobile sites, or in your CI/CD pipelines with the SDK. Codex is the best way to get agentic software engineering on your projects.12[**Codex**](https://developers.openai.com/codex/overview) is OpenAI's coding agent for software development. It helps you write, review and debug code. Interact with Codex in a variety of interfaces: in your IDE, through the CLI, on web and mobile sites, or in your CI/CD pipelines with the SDK. Codex is the best way to get agentic software engineering on your projects.
13 13
14Codex works best with the latest models from the GPT-5 family, such as [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5). We offer a range of models specifically designed to work with coding agents like Codex, such as [`gpt-5.3-codex`](https://developers.openai.com/api/docs/models/gpt-5.3-codex), but we recommend using the latest general-purpose model for most code generation tasks.14Codex works best with the latest models from the GPT-5 family, such as [`gpt-5.6`](https://developers.openai.com/api/docs/models/gpt-5.6-sol). We offer a range of models specifically designed to work with coding agents like Codex, such as [`gpt-5.3-codex`](https://developers.openai.com/api/docs/models/gpt-5.3-codex), but we recommend using the latest general-purpose model for most code generation tasks.
15 15
16See the [Codex docs](https://developers.openai.com/codex) for setup guides, reference material, pricing, and more information.16See the [Codex docs](https://developers.openai.com/codex) for setup guides, reference material, pricing, and more information.
17 17
18## Integrate with coding models18## Integrate with coding models
19 19
20For most API-based code generation, start with <strong>`gpt-5.5`</strong>. It handles both general-purpose work and coding, which makes it a strong default when your application needs to write code, reason about requirements, inspect docs, and handle broader workflows in one place.20For most API-based code generation, start with <strong>`gpt-5.6`</strong>. It handles both general-purpose work and coding, which makes it a strong default when your application needs to write code, reason about requirements, inspect docs, and handle broader workflows in one place.
21 21
22This example shows how you can use the [Responses API](https://developers.openai.com/api/docs/api-reference/responses) for a code generation use case:22This example shows how you can use the [Responses API](https://developers.openai.com/api/docs/api-reference/responses) for a code generation use case:
23 23
28const openai = new OpenAI();28const openai = new OpenAI();
29 29
30const result = await openai.responses.create({30const result = await openai.responses.create({
31 model: "gpt-5.5",31 model: "gpt-5.6",
32 input: "Find the null pointer exception: ...your code here...",32 input: "Find the null pointer exception: ...your code here...",
33 reasoning: { effort: "high" },33 reasoning: { effort: "high" },
34});34});
41client = OpenAI()41client = OpenAI()
42 42
43result = client.responses.create(43result = client.responses.create(
44 model="gpt-5.5",44 model="gpt-5.6",
45 input="Find the null pointer exception: ...your code here...",45 input="Find the null pointer exception: ...your code here...",
46 reasoning={ "effort": "high" },46 reasoning={ "effort": "high" },
47)47)
54 -H "Content-Type: application/json" \54 -H "Content-Type: application/json" \
55 -H "Authorization: Bearer $OPENAI_API_KEY" \55 -H "Authorization: Bearer $OPENAI_API_KEY" \
56 -d '{56 -d '{
57 "model": "gpt-5.5",57 "model": "gpt-5.6",
58 "input": "Find the null pointer exception: ...your code here...",58 "input": "Find the null pointer exception: ...your code here...",
59 "reasoning": { "effort": "high" }59 "reasoning": { "effort": "high" }
60 }'60 }'
70## Next steps70## Next steps
71 71
72- Visit the [Codex docs](https://developers.openai.com/codex) to learn what you can do with Codex, set up Codex in whichever interface you choose, or find more details.72- Visit the [Codex docs](https://developers.openai.com/codex) to learn what you can do with Codex, set up Codex in whichever interface you choose, or find more details.
73- Read <a href="/api/docs/guides/latest-model">Using GPT-5.5</a> for model selection, features, and migration guidance.73- Read <a href="/api/docs/guides/latest-model">Model guidance</a> for model selection, features, migration guidance, and prompting patterns that work well on coding and agentic tasks.
74- See <a href="/api/docs/guides/prompt-guidance">Prompt guidance for GPT-5.5</a> for prompting patterns that work well on coding and agentic tasks.74- Compare [`gpt-5.6`](https://developers.openai.com/api/docs/models/gpt-5.6-sol) and [`gpt-5.3-codex`](https://developers.openai.com/api/docs/models/gpt-5.3-codex) on the model pages.
75- Compare [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and [`gpt-5.3-codex`](https://developers.openai.com/api/docs/models/gpt-5.3-codex) on the model pages.