{"slug": "openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it", "title": "OpenAI's API can now keep reasoning across turns instead of discarding it", "summary": "OpenAI updated its API to allow reasoning models like GPT-5.5 and GPT-5.6 to retain reasoning context across conversation turns, improving performance on complex multi-step tasks. The new feature, available via the Responses API, supports adjustable reasoning effort levels from none to xhigh, enabling developers to balance speed and quality.", "body_md": "## ··· 1 unchanged block (1 paragraph) — click to show\n\n**Reasoning models** like [GPT-5.5](https://developers.openai.com/api/docs/models/gpt-5.5) use internal reasoning tokens before producing a response. This helps the model plan, use tools effectively, inspect alternatives, recover from ambiguity, and solve harder multi-step tasks. Reasoning models work especially well for complex problem solving, coding, scientific reasoning, and multi-step agentic workflows. They’re also the best models for [Codex CLI](https://github.com/openai/codex), our lightweight coding agent.\n\nStart with `gpt-5.6`\n\n~~Start with ~~ for most reasoning workloads. If you need the highest-intelligence API option for more challenging problems that can tolerate more latency, use `gpt-5.5`\n\n[ gpt-5.5-pro ](https://developers.openai.com/api/docs/models/gpt-5.5-pro). For lower cost, consider\n\n`gpt-5.4`\n\nand for lower cost and latency, consider `gpt-5.4-mini`\n\n.## ··· 3 unchanged blocks (Get started with reasoning) — click to show\n\n**Reasoning models work better with the Responses\nAPI**. While the Chat Completions API\nis still supported, you’ll get improved model intelligence and performance by\nusing Responses.\n\n## Get started with reasoning\n\nCall the [Responses API](https://developers.openai.com/api/docs/api-reference/responses/create) and specify your reasoning model and reasoning effort:\n\n``` python\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n-\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\nfrom openai import OpenAI\n\nclient = OpenAI()\n\nprompt = \"\"\"\nWrite a bash script that takes a matrix represented as a string with \nformat '[1,2],[3,4],[5,6]' and prints the transpose in the same format.\n\"\"\"\n\nresponse = client.responses.create(\n    model=\"gpt-5.5\",\n    model=\"gpt-5.6\",\n    reasoning={\"effort\": \"low\"},\n    input=[\n        {\n            \"role\": \"user\", \n            \"content\": prompt\n        }\n    ]\n)\n\nprint(response.output_text)\n```\n\n## ··· 4 unchanged blocks (Reasoning effort) — click to show\n\n## Reasoning effort\n\nThe `reasoning.effort`\n\nparameter guides the model on how much to think when performing a task.\n\nSupported values are model-dependent and can include `none`\n\n, `minimal`\n\n, `low`\n\n, `medium`\n\n, `high`\n\n, and `xhigh`\n\n. Lower effort favors speed and lower token usage, while at higher effort the model thinks more completely to provide higher quality responses. The models also reason adaptively across reasoning efforts, using fewer tokens for simpler tasks and thinking harder for complex tasks.\n\nDefaults are also model-dependent rather than universal. `gpt-5.5`\n\ndefaults to `medium`\n\nreasoning effort. This is the best starting point for `gpt-5.5`\n\n’s full balance of quality, reliability and performance.\n\n| Effort | Best for |\n|---|---|\n`none` | Latency-critical tasks that do not benefit from any reasoning or multi-chained tool calls. For latency-sensitive use cases with `gpt-5.5` , we recommend trying `low` to begin with and then moving to `none` if required.Common use cases include voice, fast information retrieval, and classification. |\n`low` | Efficient reasoning with a modest latency increase. Ideal for use cases requiring tool-use, planning, search, or multi-step decision making, while optimizing for speed and cost. Common use cases include data analysis, drafting, execution-oriented coding, and customer support / chat assistant workflows. |\n`medium` | When quality and reliability matter, and the task involves planning, complex reasoning, and judgement. Default configuration for most workloads, and a well-balanced point on the pareto curve of latency, performance and cost. Common use cases include agentic coding, research, working with spreadsheets & slides, and delegating long-horizon work. |\n`high` | Hard reasoning, complex debugging, deep planning, and high-value tasks where quality and intelligence matters more than latency. Recommended for complex workflows and agentic tasks. Common use cases include agentic coding, long-horizon research, and knowledge work. Depending on the complexity of the task, evaluate both `medium` and `high` . |\n`xhigh` | Deep research, asynchronous workflows and agentic tasks that require long runs. Common use cases include security and code review, enterprise productivity, deeper research tasks, and challenging coding workflows. |\n\n## ··· 2 unchanged blocks (2 paragraphs) — click to show\n\nFor faster time to first visible token in latency-sensitive applications, ask the model to generate a short preamble before continuing with deeper reasoning.\n\nSome models support only a subset of these values, so check the relevant [model page](https://developers.openai.com/api/docs/models) before choosing a setting.\n\n## Reasoning mode\n\nGPT-5.6 models support `standard`\n\nand `pro`\n\nreasoning modes in the Responses API. `standard`\n\nis the default. Set `reasoning.mode`\n\nto `pro`\n\nfor difficult tasks that need more model work and can tolerate higher latency and token usage.\n\nReasoning mode and reasoning effort are independent. Mode selects standard or pro execution, while `reasoning.effort`\n\ncontrols how much reasoning the model applies within that mode. If you omit `reasoning.effort`\n\n, GPT-5.6 defaults to `medium`\n\nin both modes.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\ncurl https://api.openai.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6\",\n    \"reasoning\": {\n      \"mode\": \"pro\",\n      \"effort\": \"medium\"\n    },\n    \"input\": \"Review this database migration plan and identify potential failure modes.\"\n  }'\n```\n\nPro mode aggregates the model work performed to produce the final answer and bills those tokens at the selected model’s standard [token rates](https://developers.openai.com/api/docs/pricing). Pro mode performs more model work than standard mode, increasing token usage and cost. Existing Pro model IDs keep their current behavior and pricing.\n\n## ··· 2 unchanged blocks (How reasoning works) — click to show\n\n## How reasoning works\n\nReasoning models introduce **reasoning tokens** in addition to input and output tokens. The models use these reasoning tokens to “think,” breaking down the prompt and considering multiple approaches to generating a response. Our reasoning models like `gpt-5.5`\n\nand `gpt-5.4`\n\nsupport interleaved thinking, where the model is able to generate visible output tokens before and in between thinking, and is able to think in between tool calls.\n\nHere is an example of a multi-step conversation between a user and an assistant. Input and output tokens from each step are carried over, while reasoning tokens are discarded.\n\nHere is the default behavior for a multi-step conversation between a user and an assistant. Input and output tokens from each step are carried over, while reasoning from earlier turns is not rendered into the next sample. Models that support persisted reasoning can change this behavior with `reasoning.context`\n\n.\n\n## ··· 11 unchanged blocks (Managing the context window, Controlling costs, Allocating space for reasoning) — click to show\n\nWhile reasoning tokens are not visible via the API, they still occupy space in\nthe model’s context window and are billed as [output\ntokens](https://openai.com/api/pricing).\n\n### Managing the context window\n\nIt’s important to ensure there’s enough space in the context window for reasoning tokens when creating responses. Depending on the problem’s complexity, the models may generate anywhere from a few hundred to tens of thousands of reasoning tokens. The exact number of reasoning tokens used is visible in the [usage object of the response object](https://developers.openai.com/api/docs/api-reference/responses/object), under `output_tokens_details`\n\n:\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n{\n  \"usage\": {\n    \"input_tokens\": 75,\n    \"input_tokens_details\": {\n      \"cached_tokens\": 0\n    },\n    \"output_tokens\": 1186,\n    \"output_tokens_details\": {\n      \"reasoning_tokens\": 1024\n    },\n    \"total_tokens\": 1261\n  }\n}\n```\n\nContext window lengths are found on the [model reference page](https://developers.openai.com/api/docs/models), and will differ across model snapshots.\n\n### Controlling costs\n\nTo manage costs with reasoning models, you can limit the total number of tokens the\nmodel generates, including reasoning tokens, visible output tokens, and non-visible\nformatting tokens, by using the\n[ max_output_tokens](https://developers.openai.com/api/docs/api-reference/responses/create#responses-create-max_output_tokens)\nparameter. See\n\n[output token counts](https://developers.openai.com/api/docs/guides/token-counting#understand-output-token-counts)for details about how generated tokens are reflected in usage and output limits.\n\n### Allocating space for reasoning\n\nIf the generated tokens reach the context window limit or the `max_output_tokens`\n\nvalue you’ve set, you’ll receive a response with a `status`\n\nof `incomplete`\n\nand `incomplete_details`\n\nwith `reason`\n\nset to `max_output_tokens`\n\n. This might occur before any visible output tokens are produced, meaning you could incur costs for input and reasoning tokens without receiving a visible response.\n\nTo prevent this, ensure there’s sufficient space in the context window or adjust the `max_output_tokens`\n\nvalue to a higher number. OpenAI recommends reserving at least 25,000 tokens for reasoning and outputs when you start experimenting with these models. As you become familiar with the number of reasoning tokens your prompts require, you can adjust this buffer accordingly.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n-\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\nfrom openai import OpenAI\n\nclient = OpenAI()\n\nprompt = \"\"\"\nWrite a bash script that takes a matrix represented as a string with \nformat '[1,2],[3,4],[5,6]' and prints the transpose in the same format.\n\"\"\"\n\nresponse = client.responses.create(\n    model=\"gpt-5.5\",\n    model=\"gpt-5.6\",\n    reasoning={\"effort\": \"medium\"},\n    input=[\n        {\n            \"role\": \"user\", \n            \"content\": prompt\n        }\n    ],\n    max_output_tokens=300,\n)\n\nif response.status == \"incomplete\" and response.incomplete_details.reason == \"max_output_tokens\":\n    print(\"Ran out of tokens\")\n    if response.output_text:\n        print(\"Partial output:\", response.output_text)\n    else: \n        print(\"Ran out of tokens during reasoning\")\n```\n\n## ··· 5 unchanged blocks (Keeping reasoning items in context) — click to show\n\n### Keeping reasoning items in context\n\nWhen doing [function calling](https://developers.openai.com/api/docs/guides/function-calling) with a reasoning model in the [Responses API](https://developers.openai.com/api/docs/api-reference/responses), we highly recommend you pass back any reasoning items returned with the last function call (in addition to the output of your function). If the model calls multiple functions consecutively, you should pass back all reasoning items, function call items, and function call output items, since the last `user`\n\nmessage. This allows the model to continue its reasoning process to produce better results in the most token-efficient manner.\n\nThe simplest way to do this is to pass in all reasoning items from a previous response into the next one. Our systems will smartly ignore any reasoning items that aren’t relevant to your functions, and only retain those in context that are relevant. You can pass reasoning items from previous responses either using the `previous_response_id`\n\nparameter, or by manually passing in all the [output](https://developers.openai.com/api/docs/api-reference/responses/object#responses/object-output) items from a past response into the [input](https://developers.openai.com/api/docs/api-reference/responses/create#responses-create-input) of a new one.\n\nFor advanced use cases where you might be truncating and optimizing parts of the context window before passing them on to the next response, just ensure all items between the last user message and your function call output are passed into the next response untouched. This will ensure that the model has all the context it needs.\n\nCheck out [this guide](https://developers.openai.com/api/docs/guides/conversation-state) to learn more about manual context management.\n\n## Preserve reasoning across calls\n\nConversation state and reasoning state serve different purposes. Passing messages across calls gives the model the visible conversation history. On supported models, persisted reasoning also lets the model render compatible reasoning items from earlier turns into its next context.\n\nPersisted reasoning provides continuity; it does not expose the model’s raw reasoning. The reasoning items remain opaque, and the API does not return their reasoning text. Set `reasoning.context`\n\nto control which available reasoning items the model can use:\n\nSupport for `reasoning.context`\n\nmodes is model-dependent. Replace\n`YOUR_MODEL_ID`\n\nin the examples with a model that supports the mode\nyou select.\n\n| Value | Behavior |\n|---|---|\n`auto` | Uses the selected model’s default. Omitting `reasoning.context` has the same effect as `auto` . |\n`current_turn` | Makes reasoning from the active turn available, but does not render reasoning from earlier turns into the next sample. |\n`all_turns` | Renders available, compatible reasoning items from earlier turns into the next sample. Only supported models accept this value. |\n\nThe response’s `reasoning.context`\n\nfield contains the effective mode, either `current_turn`\n\nor `all_turns`\n\n. Check this field on each response to confirm which mode the model used. The setting does not create reasoning items that are not already available.\n\n`all_turns`\n\nhas an effect only when the request has access to earlier response items. Use `previous_response_id`\n\n, attach the response to a conversation, or manually replay the complete response history. On the first request, `current_turn`\n\nand `all_turns`\n\nbehave the same because no earlier reasoning exists.\n\n### Continue reasoning with stored responses\n\n~~Encrypted reasoning items~~\n\nWhen using the Responses API in a stateless mode (either with `store`\n\nset to `false`\n\n, or when an organization is enrolled in zero data retention), you must still retain reasoning items across conversation turns using the techniques described above. But in order to have reasoning items that can be sent with subsequent API requests, each of your API requests must have `reasoning.encrypted_content`\n\nin the `include`\n\nparameter of API requests, like so:\n\nUse `previous_response_id`\n\nfor the shortest stateful integration:\n\n``` python\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\nfrom openai import OpenAI\n\nclient = OpenAI()\n\nfirst = client.responses.create(\n    model=\"YOUR_MODEL_ID\",\n    input=\"Inspect this repository and identify the likely bug.\",\n    reasoning={\"context\": \"current_turn\"},\n)\n\nsecond = client.responses.create(\n    model=\"YOUR_MODEL_ID\",\n    previous_response_id=first.id,\n    input=\"Now patch the bug and explain the change.\",\n    reasoning={\"context\": \"all_turns\"},\n)\n\nprint(second.output_text)\n```\n\nUse `current_turn`\n\nwhen replaying older response items that the model no longer needs. Those reasoning items can remain in the API payload for continuity, but the service does not render them into the new sample. This can reduce the rendered context for long-running workflows.\n\n### Preserve reasoning without stored responses\n\nWhen using the Responses API in a stateless mode, either with `store`\n\nset to `false`\n\nor for an organization enrolled in zero data retention, request `reasoning.encrypted_content`\n\nin the `include`\n\nparameter on every call:\n\n```\n1\n2\n3\n4\n-\n5\n6\n7\n8\n9\n10\ncurl https://api.openai.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.5\",\n    \"model\": \"gpt-5.6\",\n    \"reasoning\": {\"effort\": \"medium\"},\n    \"input\": \"What is the weather like today?\",\n    \"tools\": [ ... function config here ... ],\n    \"include\": [ \"reasoning.encrypted_content\" ]\n  }'\n```\n\nReasoning ~~Any reasoning~~ items in the `output`\n\narray will include an `encrypted_content`\n\nproperty containing ~~now have an ~~ encrypted reasoning tokens that you can pass to future calls. `encrypted_content`\n\nproperty, which will contain~~can be passed along with future conversation turns.~~\n\nTo use `all_turns`\n\nwith `store: false`\n\n, request encrypted reasoning content on every call, preserve every output item, append the next user message, and replay the complete history:\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\nfrom openai import OpenAI\n\nclient = OpenAI()\n\nhistory = [\n    {\n        \"role\": \"user\",\n        \"content\": \"Inspect this repository and identify the likely bug.\",\n    }\n]\n\nfirst = client.responses.create(\n    model=\"YOUR_MODEL_ID\",\n    store=False,\n    input=history,\n    include=[\"reasoning.encrypted_content\"],\n    reasoning={\"context\": \"current_turn\"},\n)\n\n# Keep every output item, including encrypted reasoning and assistant phase.\nhistory.extend(item.model_dump() for item in first.output)\nhistory.append(\n    {\n        \"role\": \"user\",\n        \"content\": \"Now patch the bug and explain the change.\",\n    }\n)\n\nsecond = client.responses.create(\n    model=\"YOUR_MODEL_ID\",\n    store=False,\n    input=history,\n    include=[\"reasoning.encrypted_content\"],\n    reasoning={\"context\": \"all_turns\"},\n)\n\nprint(second.output_text)\n```\n\n## ··· 5 unchanged blocks (Reasoning summaries) — click to show\n\n## Reasoning summaries\n\nWhile we don’t expose the raw reasoning tokens emitted by the model, you can view a summary of the model’s reasoning using the `summary`\n\nparameter. See our [model documentation](https://developers.openai.com/api/docs/models) to check which reasoning models support summaries.\n\nDifferent models support different reasoning summary settings. For example, our computer use model supports the `concise`\n\nsummarizer, while o4-mini supports `detailed`\n\n. To access the most detailed summarizer available for a model, set the value of this parameter to `auto`\n\n. `auto`\n\nwill be equivalent to `detailed`\n\nfor most reasoning models today, but there may be more granular settings in the future.\n\nReasoning summary output is part of the `summary`\n\narray in the `reasoning`\n\n[output item](https://developers.openai.com/api/docs/api-reference/responses/object#responses/object-output). This output will not be included unless you explicitly opt in to including reasoning summaries.\n\nThe example below shows how to make an API request that includes a reasoning summary.\n\n``` python\n1\n2\n3\n4\n-\n5\n6\n7\n8\n9\n10\n11\n12\n13\nfrom openai import OpenAI\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\"gpt-5.5\",\n    model=\"gpt-5.6\",\n    input=\"What is the capital of France?\",\n    reasoning={\n        \"effort\": \"low\",\n        \"summary\": \"auto\"\n    }\n)\n\nprint(response.output)\n```\n\n## ··· 6 unchanged blocks (phase parameter, Round-trip assistant phase values) — click to show\n\nThis API request will return an output array with both an assistant message and a summary of the model’s reasoning in generating that response.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n[\n  {\n    \"id\": \"rs_6876cf02e0bc8192b74af0fb64b715ff06fa2fcced15a5ac\",\n    \"type\": \"reasoning\",\n    \"summary\": [\n      {\n        \"type\": \"summary_text\",\n        \"text\": \"**Answering a simple question**\\n\\nI\\u2019m looking at a straightforward question: the capital of France is Paris. It\\u2019s a well-known fact, and I want to keep it brief and to the point. Paris is known for its history, art, and culture, so it might be nice to add just a hint of that charm. But mostly, I\\u2019ll aim to focus on delivering a clear and direct answer, ensuring the user gets what they\\u2019re looking for without any extra fluff.\"\n      }\n    ]\n  },\n  {\n    \"id\": \"msg_6876cf054f58819284ecc1058131305506fa2fcced15a5ac\",\n    \"type\": \"message\",\n    \"status\": \"completed\",\n    \"content\": [\n      {\n        \"type\": \"output_text\",\n        \"annotations\": [],\n        \"logprobs\": [],\n        \"text\": \"The capital of France is Paris.\"\n      }\n    ],\n    \"role\": \"assistant\"\n  }\n]\n```\n\nBefore using summarizers with our latest reasoning models, you may need to\ncomplete [organization\nverification](https://help.openai.com/en/articles/10910291-api-organization-verification)\nto ensure safe deployment. Get started with verification on the [platform\nsettings page](https://platform.openai.com/settings/organization/general).\n\n`phase`\n\nparameter\n\nFor long-running or tool-heavy flows with GPT-5.5 and GPT-5.4 in the Responses API, use the assistant message `phase`\n\nfield to avoid early stopping and other misbehavior.\n`phase`\n\nis optional at the API level, but OpenAI recommends using it. Use `phase: \"commentary\"`\n\nfor intermediate assistant updates, such as preambles before tool calls, and `phase: \"final_answer\"`\n\nfor the completed answer. Don’t add `phase`\n\nto user messages.\nUsing `previous_response_id`\n\nis usually the simplest path because prior assistant state is preserved. If you replay assistant history manually, preserve each original `phase`\n\nvalue.\nMissing or dropped `phase`\n\ncan cause preambles to be treated as final answers in those workflows. For model-specific prompt guidance, see [Prompting GPT-5.5](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-5.5#prompting-best-practices).\n\n### Round-trip assistant phase values\n\n```\n1\n2\n3\n4\n5\n-\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\nfrom openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\"gpt-5.5\",\n    model=\"gpt-5.6\",\n    input=[\n        {\n            \"role\": \"assistant\",\n            \"phase\": \"commentary\",\n            \"content\": \"I’ll inspect the logs and then summarize root cause and remediation.\",\n        },\n        {\n            \"role\": \"assistant\",\n            \"phase\": \"final_answer\",\n            \"content\": \"Root cause: cache invalidation race.\",\n        },\n        {\n            \"role\": \"user\",\n            \"content\": \"Great—now give me a rollout-safe fix plan.\",\n        },\n    ],\n)\n\nprint(response.output_text)\n```\n\n## ··· 1 unchanged block (Advice on prompting) — click to show\n\n## Advice on prompting\n\nConsider these differences ~~There are some differences to consider~~ when prompting a reasoning model. Reasoning-capable GPT-5 models usually work best when you give them a clear goal, strong constraints, and an explicit output contract without prescribing every intermediate step.\n\n## ··· 8 unchanged blocks (Prompt examples, Use case examples) — click to show\n\n- Give the model the task, constraints, and desired output format.\n- Treat\n`reasoning.effort`\n\nas a tuning knob, not the primary way to recover quality. - For agentic or research-heavy workflows, define what counts as done and how the model should verify its work.\n\nFor more information on best practices when using reasoning models, [refer to this guide](https://developers.openai.com/api/docs/guides/reasoning-best-practices).\n\n### Prompt examples\n\nOpenAI o-series models are able to implement complex algorithms and produce code. This prompt asks o1 to refactor a React component based on some specific criteria.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nInstructions:\n- Given the React component below, change it so that nonfiction books have red\ntext.\n- Return only the code in your reply\n- Do not include any additional formatting, such as markdown code blocks\n- For formatting, use four space tabs, and do not allow any lines of code to\nexceed 80 columns\nconst books = [\n{ title: 'Dune', category: 'fiction', id: 1 },\n{ title: 'Frankenstein', category: 'fiction', id: 2 },\n{ title: 'Moneyball', category: 'nonfiction', id: 3 },\n];\nexport default function BookList() {\nconst listItems = books.map(book =>\n<li>\n{book.title}\n</li>\n);\nreturn (\n<ul>{listItems}</ul>\n);\n}\n`.trim();\nconst completion = await openai.chat.completions.create({\nmodel: \"gpt-5.6\",\nmessages: [\n{\nrole: \"user\",\ncontent: prompt,\n},\n],\nstore: true,\n});\nconsole.log(completion.choices[0].message.content);\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nInstructions:\n- Given the React component below, change it so that nonfiction books have red\ntext.\n- Return only the code in your reply\n- Do not include any additional formatting, such as markdown code blocks\n- For formatting, use four space tabs, and do not allow any lines of code to\nexceed 80 columns\nconst books = [\n{ title: 'Dune', category: 'fiction', id: 1 },\n{ title: 'Frankenstein', category: 'fiction', id: 2 },\n{ title: 'Moneyball', category: 'nonfiction', id: 3 },\n];\nexport default function BookList() {\nconst listItems = books.map(book =>\n<li>\n{book.title}\n</li>\n);\nreturn (\n<ul>{listItems}</ul>\n);\n}\n`.trim();\nconst response = await openai.responses.create({\nmodel: \"gpt-5.6\",\ninput: [\n{\nrole: \"user\",\ncontent: prompt,\n},\n],\n});\nconsole.log(response.output_text);\n\nOpenAI o-series models are also adept in creating multi-step plans. This example prompt asks o1 to create a filesystem structure for a full solution, along with Python code that implements the desired use case.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nI want to build a Python app that takes user questions and looks\nthem up in a database where they are mapped to answers. If there\nis close match, it retrieves the matched answer. If there isn't,\nit asks the user to provide an answer and stores the\nquestion/answer pair in the database. Make a plan for the directory\nstructure you'll need, then return each file in full. Only supply\nyour reasoning at the beginning and end, not throughout the code.\n`.trim();\nconst completion = await openai.chat.completions.create({\nmodel: \"gpt-5.6\",\nmessages: [\n{\nrole: \"user\",\ncontent: prompt,\n},\n],\nstore: true,\n});\nconsole.log(completion.choices[0].message.content);\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nI want to build a Python app that takes user questions and looks\nthem up in a database where they are mapped to answers. If there\nis close match, it retrieves the matched answer. If there isn't,\nit asks the user to provide an answer and stores the\nquestion/answer pair in the database. Make a plan for the directory\nstructure you'll need, then return each file in full. Only supply\nyour reasoning at the beginning and end, not throughout the code.\n`.trim();\nconst response = await openai.responses.create({\nmodel: \"gpt-5.6\",\ninput: [\n{\nrole: \"user\",\ncontent: prompt,\n},\n],\n});\nconsole.log(response.output_text);\n\nOpenAI o-series models have shown excellent performance in STEM research. Prompts asking for support of basic research tasks should show strong results.\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nWhat are three compounds we should consider investigating to\nadvance research into new antibiotics? Why should we consider\nthem?\n`;\nconst completion = await openai.chat.completions.create({\nmodel: \"gpt-5.6\",\nmessages: [\n{\nrole: \"user\",\ncontent: prompt,\n}\n],\nstore: true,\n});\nconsole.log(completion.choices[0].message.content);\n\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n```\n\nimport OpenAI from \"openai\";\nconst openai = new OpenAI();\nconst prompt = `\nWhat are three compounds we should consider investigating to\nadvance research into new antibiotics? Why should we consider\nthem?\n`;\nconst response = await openai.responses.create({\nmodel: \"gpt-5.6\",\ninput: [\n{\nrole: \"user\",\ncontent: prompt,\n},\n],\n});\nconsole.log(response.output_text);\n\n## Use case examples\n\nSome examples of using reasoning models for real-world use cases can be found in [the cookbook](https://developers.openai.com/cookbook).\n\n[ Using reasoning for data validation ](https://cookbook.openai.com/examples/o1/using_reasoning_for_data_validation)\n\nEvaluate a synthetic medical data set for discrepancies.\n\n[ Using reasoning for routine generation ](https://cookbook.openai.com/examples/o1/using_reasoning_for_routine_generation)\n\nUse help center articles to generate actions that an agent could perform.", "url": "https://wpnews.pro/news/openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it", "canonical_source": "https://drop-05a4352b-803.sophisticated-stay.workers.dev", "published_at": "2026-07-10 02:19:07+00:00", "updated_at": "2026-07-10 02:36:03.590052+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "developer-tools"], "entities": ["OpenAI", "GPT-5.5", "GPT-5.6", "Responses API", "Chat Completions API", "Codex CLI"], "alternates": {"html": "https://wpnews.pro/news/openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it", "markdown": "https://wpnews.pro/news/openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it.md", "text": "https://wpnews.pro/news/openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it.txt", "jsonld": "https://wpnews.pro/news/openai-s-api-can-now-keep-reasoning-across-turns-instead-of-discarding-it.jsonld"}}