SpyBara
Go Premium

Documentation 2026-06-03 06:53 UTC to 2026-06-04 06:52 UTC

41 files changed +561 −346. View all changes and history on the product overview
2026
Wed 24 22:02 Tue 23 15:59 Mon 22 22:58 Tue 16 21:57 Mon 15 23:02 Fri 12 19:02 Thu 11 08:59 Wed 10 15:48 Tue 9 06:34 Fri 5 06:45 Thu 4 06:52 Wed 3 06:53 Tue 2 06:51 Mon 1 06:53
Details

16 16 

17## IP egress ranges17## IP egress ranges

18 18 

19ChatGPT will call your action from an IP address from one of the [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) listed in [chatgpt-connectors.json](https://openai.com/chatgpt-connectors.json)19ChatGPT will call your action from one of the [published IP ranges](https://developers.openai.com/api/docs/guides/ip-addresses). You may wish to explicitly allowlist these IP addresses.

20 

21You may wish to explicitly allowlist these IP addresses. This list is updated automatically periodically.

22 20 

23## Multiple authentication schemas21## Multiple authentication schemas

24 22 

Details

156 "incomplete_details": null,156 "incomplete_details": null,

157 "instructions": null,157 "instructions": null,

158 "metadata": {},158 "metadata": {},

159 "model": "gpt-4.1-2025-04-14",159 "model": "gpt-5.5",

160 "object": "response",160 "object": "response",

161 "output": [161 "output": [

162 {162 {


230 230 

231This will create a prompt object out of each existing assistant object.231This will create a prompt object out of each existing assistant object.

232 232 

233Reusable prompt objects are also being deprecated. If you use this migration

234 path, review the [prompts deprecation

235 timeline](https://developers.openai.com/api/docs/deprecations#2026-06-03-reusable-prompts) before adopting

236 prompt objects in a long-lived integration.

237 

233### 2. Move new user chats over to conversations and responses238### 2. Move new user chats over to conversations and responses

234 239 

235We will not provide an automated tool for migrating Threads to Conversations. Instead, we recommend migrating new user threads onto conversations and backfilling old ones as necessary.240We will not provide an automated tool for migrating Threads to Conversations. Instead, we recommend migrating new user threads onto conversations and backfilling old ones as necessary.

concepts.md +1 −1

Details

6 6 

7## Text generation models7## Text generation models

8 8 

9OpenAI's text generation models (often referred to as generative pre-trained transformers or "GPT" models for short), like GPT-4 and GPT-3.5, have been trained to understand natural and formal language. Models like GPT-4 allows text outputs in response to their inputs. The inputs to these models are also referred to as "prompts". Designing a prompt is essentially how you "program" a model like GPT-4, usually by providing instructions or some examples of how to successfully complete a task. Models like GPT-4 can be used across a great variety of tasks including content or code generation, summarization, conversation, creative writing, and more. Read more in our introductory [text generation guide](https://developers.openai.com/api/docs/guides/text-generation) and in our [prompt engineering guide](https://developers.openai.com/api/docs/guides/prompt-engineering).9OpenAI's text generation models (often referred to as generative pre-trained transformers or "GPT" models for short), like [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and [`gpt-5.4-mini`](https://developers.openai.com/api/docs/models/gpt-5.4-mini), have been trained to understand natural and formal language. These models allow text outputs in response to their inputs. The inputs to these models are also referred to as "prompts." Designing a prompt is essentially how you "program" a model, usually by providing instructions or some examples of how to successfully complete a task. GPT models can be used across a great variety of tasks including content or code generation, summarization, conversation, creative writing, and more. Read more in our introductory [text generation guide](https://developers.openai.com/api/docs/guides/text-generation) and in our [prompt engineering guide](https://developers.openai.com/api/docs/guides/prompt-engineering).

10 10 

11## Embeddings11## Embeddings

12 12 

deprecations.md +36 −0

Details

32 32 

33Upcoming deprecations are listed below, with the most recent announcements at the top.33Upcoming deprecations are listed below, with the most recent announcements at the top.

34 34 

35### 2026-06-03: Reusable prompts

36 

37On June 3, 2026, we notified developers using reusable prompts in the dashboard and API that reusable prompt objects are being deprecated.

38 

39| Date | Update |

40| ------------ | ---------------------------------------------------------------------------- |

41| June 3, 2026 | Deprecation announced and prompt creation de-emphasized in the platform. |

42| Nov 30, 2026 | The `v1/prompts` API and reusable prompt objects are scheduled to shut down. |

43 

44To migrate, move reusable prompt content into your application code. See [Migrate from prompt objects](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object).

45 

46### 2026-06-03: Evals platform

47 

48On June 3, 2026, we notified developers using the Evals platform that the product is being deprecated.

49 

50| Date | Update |

51| ------------ | ------------------------------------------------------- |

52| June 3, 2026 | Deprecation announced for the Evals platform. |

53| Oct 31, 2026 | Existing evals become read-only. |

54| Nov 30, 2026 | The Evals dashboard and API are scheduled to shut down. |

55 

56Graders documented for eval workflows are part of this transition. Fine-tuning-related timelines remain covered in the self-serve fine-tuning section below.

57 

58See [Moving from OpenAI Evals to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo) for a migration path.

59 

60### 2026-06-03: Agent Builder

61 

62On June 3, 2026, we notified developers using Agent Builder that the product is being deprecated. ChatKit remains available.

63 

64| Date | Update |

65| ------------ | ---------------------------------------- |

66| June 3, 2026 | Deprecation announced for Agent Builder. |

67| Nov 30, 2026 | Agent Builder is scheduled to shut down. |

68 

69See [Migrate from Agent Builder](https://developers.openai.com/api/docs/guides/agent-builder/migrate-from-agent-builder) to continue with the Agents SDK or ChatGPT Workspace Agents.

70 

35### 2026-06-02: GPT Image model deprecations71### 2026-06-02: GPT Image model deprecations

36 72 

37On June 2, 2026, we notified developers using older GPT Image models of their deprecation and removal from the API on December 1, 2026.73On June 2, 2026, we notified developers using older GPT Image models of their deprecation and removal from the API on December 1, 2026.

Details

4 4 

5You can start from templates, drag and drop nodes for each step in your workflow, provide typed inputs and outputs, and preview runs using live data. When you're ready to deploy, embed the workflow into your site with ChatKit, or download the SDK code to run it yourself.5You can start from templates, drag and drop nodes for each step in your workflow, provide typed inputs and outputs, and preview runs using live data. When you're ready to deploy, embed the workflow into your site with ChatKit, or download the SDK code to run it yourself.

6 6 

7OpenAI is deprecating Agent Builder. Existing users can continue using it

8 during the transition window, and the product is scheduled to shut down on

9 November 30, 2026. ChatKit remains available. See the [deprecations

10 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-agent-builder) for the current

11 timeline.

12 

7Use this guide to learn the process and parts of building agents.13Use this guide to learn the process and parts of building agents.

8 14 

9## Agents and workflows15## Agents and workflows

Details

2 2 

3As you build and deploy agents with [Agent Builder](https://developers.openai.com/api/docs/guides/agent-builder), it's important to understand the risks. Learn about risk types and how to mitigate them when building multi-agent workflows.3As you build and deploy agents with [Agent Builder](https://developers.openai.com/api/docs/guides/agent-builder), it's important to understand the risks. Learn about risk types and how to mitigate them when building multi-agent workflows.

4 4 

5OpenAI is deprecating Agent Builder. Existing users can continue using it

6 during the transition window, and the product is scheduled to shut down on

7 November 30, 2026. ChatKit remains available. See the [deprecations

8 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-agent-builder) for the current

9 timeline.

10 

5## Types of risk11## Types of risk

6 12 

7Certain agent workflow patterns are more vulnerable to risk. In chat workflows, two important considerations are protecting user input and being careful about MCP tool calling.13Certain agent workflow patterns are more vulnerable to risk. In chat workflows, two important considerations are protecting user input and being careful about MCP tool calling.

Details

1# Migrate from Agent Builder

2 

3Use this guide to export an existing Agent Builder workflow as Agents SDK code.

4You can use the export to recreate the workflow as a ChatGPT Workspace Agent or

5continue with the Agents SDK in your application.

6 

7This process does not convert your workflow graph or guarantee that every

8behavior transfers unchanged.

9 

10## Choose a migration path

11 

12- **Agents SDK**: Best for building agents through code.

13- **ChatGPT Workspace Agents**: Best for building agents through natural

14 language and sharing them with teams.

15 

16## Before you migrate

17 

18You need access to the workflow in

19[Agent Builder](https://developers.openai.com/api/docs/guides/agent-builder).

20 

21## Export your workflow

22 

231. Open your workflow in Agent Builder.

241. Select **Code** in the top navigation.

251. Select **Agents SDK** in the code dialog.

261. Select **TypeScript** or **Python**, then copy the complete export.

27 

28![Agent Builder Code dialog with Agents SDK selected](https://developers.openai.com/images/platform/guides/agent-builder/agents-sdk-export.png)

29 

30## Option 1: Continue with the Agents SDK

31 

32Use this option when you want to run the exported workflow in an application

33you build and deploy.

34 

35Copy the TypeScript or Python export into your application, install and

36configure the matching Agents SDK, and test the workflow in your runtime. For

37guidance on configuring and running the export, see the

38[Agents SDK overview](https://developers.openai.com/api/docs/guides/agents) and

39[quickstart](https://developers.openai.com/api/docs/guides/agents/quickstart).

40Validate your application's configuration and behavior before deploying it.

41 

42## Option 2: Create a workspace agent from the export

43 

44To use this option, you need a ChatGPT Business, Enterprise, or Edu workspace

45with access to [workspace agents](https://chatgpt.com/agents) and permission to

46create agents.

47 

48In ChatGPT, [create a workspace agent](https://chatgpt.com/agents/studio/new).

49Paste your exported code into the chat with this prompt:

50 

51```text

52Please help me convert this workflow into an agent:

53 

54<paste your exported code here>

55```

56 

57Review any behavior that the builder identifies as requiring changes before you

58continue.

59 

60## Review and test the agent

61 

62Some workflow behavior may need manual recreation. Review control flow,

63triggers, tools, and permissions as you test the migrated agent.

64 

65Before creating the agent:

66 

671. Review the generated instructions and configured capabilities.

681. Configure any required apps, tools, skills, authentication, and connection

69 permissions.

701. Select **Preview** and test representative inputs from the original

71 workflow.

721. Compare the previewed behavior with the original workflow's expected

73 behavior.

741. Select **Create** only after you have validated the migrated agent.

75 

76Follow the same safety practices you used for your workflow, especially when

77the agent can access private data or take actions through connected tools.

78 

79## Limitations

80 

81- Workflows with strong determinism at their core may not migrate faithfully to

82 a workspace agent.

83- Connected apps, authentication, publishing, and permission configuration

84 require separate review in ChatGPT.

85- An Agents SDK implementation requires you to validate your application's

86 runtime configuration, tools, authentication, permissions, and deployment.

87 

88## Related resources

89 

90- [Agent Builder](https://developers.openai.com/api/docs/guides/agent-builder)

91- [Safety in building agents](https://developers.openai.com/api/docs/guides/agent-builder-safety)

92- [Agents SDK overview](https://developers.openai.com/api/docs/guides/agents)

93- [Agents SDK quickstart](https://developers.openai.com/api/docs/guides/agents/quickstart)

94- [Build workspace agents in ChatGPT for repeatable work](https://developers.openai.com/cookbook/articles/chatgpt-agents-sales-meeting-prep)

guides/agents.md +7 −10

Details

2 2 

3Agents are applications that plan, call tools, collaborate across specialists, and keep enough state to complete multi-step work.3Agents are applications that plan, call tools, collaborate across specialists, and keep enough state to complete multi-step work.

4 4 

5- Use the **OpenAI client libraries** when you want direct API clients for model requests.5- Use the [**Responses API**](https://developers.openai.com/api/reference/responses/overview) when one model call plus tools and application-owned logic is enough.

6- Use the **Agents SDK** pages when your application owns orchestration, tool execution, approvals, and state.6- Use the **Agents SDK** pages when your application owns orchestration, tool execution, approvals, and state.

7- Use **Agent Builder** only when you specifically want the hosted workflow editor and ChatKit path.7 

8## Get your first agent running

9 

10Start with the [Agents SDK quickstart](https://developers.openai.com/api/docs/guides/agents/quickstart) to install the SDK, define one agent, and run it. Once that works, return here to choose the next capability your application needs.

8 11 

9## Get the Agents SDK12## Get the Agents SDK

10 13 

11Use the GitHub repositories for installation, issues, examples, and language-specific reference details.14Use the GitHub repositories for more examples, issues, and language-specific reference details.

12 15 

13<div class="not-prose mt-4 grid gap-3">16<div class="not-prose mt-4 grid gap-3">

14 <a17 <a


55| Understand what a run returns | [Results and state](https://developers.openai.com/api/docs/guides/agents/results) | This page explains final output, resumable state, and next-turn surfaces. |58| Understand what a run returns | [Results and state](https://developers.openai.com/api/docs/guides/agents/results) | This page explains final output, resumable state, and next-turn surfaces. |

56| Add hosted tools, function tools, or MCP | [Using tools](https://developers.openai.com/api/docs/guides/tools#usage-in-the-agents-sdk) and [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) | Tool semantics live in the platform tools docs; SDK-specific MCP and tracing live here. |59| Add hosted tools, function tools, or MCP | [Using tools](https://developers.openai.com/api/docs/guides/tools#usage-in-the-agents-sdk) and [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) | Tool semantics live in the platform tools docs; SDK-specific MCP and tracing live here. |

57| Inspect and improve runs | [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) and [evaluate agent workflows](https://developers.openai.com/api/docs/guides/agent-evals) | Use traces for debugging first, then move into evaluation loops. |60| Inspect and improve runs | [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) and [evaluate agent workflows](https://developers.openai.com/api/docs/guides/agent-evals) | Use traces for debugging first, then move into evaluation loops. |

58| Build a voice-first workflow | [Voice agents](https://developers.openai.com/api/docs/guides/voice-agents) | Voice is still an SDK-first path because Agent Builder doesn't support it. |61| Build a voice-first workflow | [Voice agents](https://developers.openai.com/api/docs/guides/voice-agents) | Use the SDK's voice pipeline and realtime agent patterns. |

59 62 

60## Build with the SDK63## Build with the SDK

61 64 


72- Use [Agent definitions](https://developers.openai.com/api/docs/guides/agents/define-agents) and [Models and providers](https://developers.openai.com/api/docs/guides/agents/models) to shape one specialist cleanly.75- Use [Agent definitions](https://developers.openai.com/api/docs/guides/agents/define-agents) and [Models and providers](https://developers.openai.com/api/docs/guides/agents/models) to shape one specialist cleanly.

73- Continue to [Running agents](https://developers.openai.com/api/docs/guides/agents/running-agents), [Orchestration and handoffs](https://developers.openai.com/api/docs/guides/agents/orchestration), and [Guardrails and human review](https://developers.openai.com/api/docs/guides/agents/guardrails-approvals) as the workflow grows more complex.76- Continue to [Running agents](https://developers.openai.com/api/docs/guides/agents/running-agents), [Orchestration and handoffs](https://developers.openai.com/api/docs/guides/agents/orchestration), and [Guardrails and human review](https://developers.openai.com/api/docs/guides/agents/guardrails-approvals) as the workflow grows more complex.

74- Use [Results and state](https://developers.openai.com/api/docs/guides/agents/results) and [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) when application logic depends on the run object or deeper visibility into behavior.77- Use [Results and state](https://developers.openai.com/api/docs/guides/agents/results) and [Integrations and observability](https://developers.openai.com/api/docs/guides/agents/integrations-observability) when application logic depends on the run object or deeper visibility into behavior.

75 

76## Use Agent Builder for the hosted workflow path

77 

78Use Agent Builder when you want OpenAI-hosted workflow creation, publishing, and ChatKit deployment. Those pages stay grouped together because they describe one product surface: building a workflow in the visual editor, publishing versions, embedding them, customizing the UI, and evaluating the results.

79 

80Voice agents are an exception: they live in the SDK track because Agent Builder doesn't currently support voice workflows. Use [Voice agents](https://developers.openai.com/api/docs/guides/voice-agents) when you need speech-to-speech or chained voice pipelines.

Details

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.4 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.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and Codex.

4 4 

5## Get started5## Get started

6 6 

Details

148 148 

149Likewise, the completions API can be used to simulate a chat between a user and an assistant by formatting the input [accordingly](https://platform.openai.com/playground/p/default-chat?model=gpt-3.5-turbo-instruct).149Likewise, the completions API can be used to simulate a chat between a user and an assistant by formatting the input [accordingly](https://platform.openai.com/playground/p/default-chat?model=gpt-3.5-turbo-instruct).

150 150 

151The difference between these APIs is the underlying models that are available in each. The Chat Completions API is the interface to our most capable model (`gpt-4o`), and our most cost effective model (`gpt-4o-mini`).

151The difference between these APIs is the underlying models that are available in each. The Chat Completions API supports current GPT models like [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and lower-cost options like [`gpt-5.4-mini`](https://developers.openai.com/api/docs/models/gpt-5.4-mini).

Details

3OpenAI provides a few ways to manage conversation state, which is important for preserving information across multiple messages or turns in a conversation.3OpenAI provides a few ways to manage conversation state, which is important for preserving information across multiple messages or turns in a conversation.

4 4 

5 5 

6 When troubleshooting cases where GPT-5.4 treats an intermediate update as6 When troubleshooting cases where GPT-5.5 treats an intermediate update as

7 the final answer, verify your integration preserves the assistant message7 the final answer, verify your integration preserves the assistant message

8 `phase` field correctly. See [Phase8 `phase` field correctly. See [Phase

9 parameter](https://developers.openai.com/api/docs/guides/reasoning#phase-parameter) for details.9 parameter](https://developers.openai.com/api/docs/guides/reasoning#phase-parameter) for details.


23const openai = new OpenAI();23const openai = new OpenAI();

24 24 

25const response = await openai.responses.create({25const response = await openai.responses.create({

26 model: "gpt-4o-mini",26 model: "gpt-5.5",

27 input: [27 input: [

28 { role: "user", content: "knock knock." },28 { role: "user", content: "knock knock." },

29 { role: "assistant", content: "Who's there?" },29 { role: "assistant", content: "Who's there?" },


40client = OpenAI()40client = OpenAI()

41 41 

42response = client.responses.create(42response = client.responses.create(

43 model="gpt-4o-mini",43 model="gpt-5.5",

44 input=[44 input=[

45 {"role": "user", "content": "knock knock."},45 {"role": "user", "content": "knock knock."},

46 {"role": "assistant", "content": "Who's there?"},46 {"role": "assistant", "content": "Who's there?"},


77];77];

78 78 

79const response = await openai.responses.create({79const response = await openai.responses.create({

80 model: "gpt-4o-mini",80 model: "gpt-5.5",

81 input: history,81 input: history,

82 store: true,82 store: true,

83});83});

84 84 

85console.log(response.output_text);85console.log(response.output_text);

86 86 

87// Add the response to the history87// Add all response output items, including reasoning items, to the history

88history = [88history = [...history, ...response.output];

89 ...history,

90 ...response.output.map((el) => {

91 // TODO: Remove this step

92 delete el.id;

93 return el;

94 }),

95];

96 89 

97history.push({90history.push({

98 role: "user",91 role: "user",


100});93});

101 94 

102const secondResponse = await openai.responses.create({95const secondResponse = await openai.responses.create({

103 model: "gpt-4o-mini",96 model: "gpt-5.5",

104 input: history,97 input: history,

105 store: true,98 store: true,

106});99});


121]114]

122 115 

123response = client.responses.create(116response = client.responses.create(

124 model="gpt-4o-mini",117 model="gpt-5.5",

125 input=history,118 input=history,

126 store=False119 store=False,

120 include=["reasoning.encrypted_content"],

127)121)

128 122 

129print(response.output_text)123print(response.output_text)

130 124 

131# Add the response to the conversation125# Add all response output items, including encrypted reasoning items, to the conversation

132history += [{"role": el.role, "content": el.content} for el in response.output]126history += response.output

133 127 

134history.append({ "role": "user", "content": "tell me another" })128history.append({ "role": "user", "content": "tell me another" })

135 129 

136second_response = client.responses.create(130second_response = client.responses.create(

137 model="gpt-4o-mini",131 model="gpt-5.5",

138 input=history,132 input=history,

139 store=False133 store=False,

134 include=["reasoning.encrypted_content"],

140)135)

141 136 

142print(second_response.output_text)137print(second_response.output_text)


171 166 

172```python167```python

173response = openai.responses.create(168response = openai.responses.create(

174 model="gpt-4.1",169 model="gpt-5.5",

175 input=[{"role": "user", "content": "What are the 5 Ds of dodgeball?"}],170 input=[{"role": "user", "content": "What are the 5 Ds of dodgeball?"}],

176 conversation="conv_689667905b048191b4740501625afd940c7533ace33a2dab"171 conversation="conv_689667905b048191b4740501625afd940c7533ace33a2dab"

177)172)


190const openai = new OpenAI();185const openai = new OpenAI();

191 186 

192const response = await openai.responses.create({187const response = await openai.responses.create({

193 model: "gpt-4o-mini",188 model: "gpt-5.5",

194 input: "tell me a joke",189 input: "tell me a joke",

195 store: true,190 store: true,

196});191});


198console.log(response.output_text);193console.log(response.output_text);

199 194 

200const secondResponse = await openai.responses.create({195const secondResponse = await openai.responses.create({

201 model: "gpt-4o-mini",196 model: "gpt-5.5",

202 previous_response_id: response.id,197 previous_response_id: response.id,

203 input: [{"role": "user", "content": "explain why this is funny."}],198 input: [{"role": "user", "content": "explain why this is funny."}],

204 store: true,199 store: true,


212client = OpenAI()207client = OpenAI()

213 208 

214response = client.responses.create(209response = client.responses.create(

215 model="gpt-4o-mini",210 model="gpt-5.5",

216 input="tell me a joke",211 input="tell me a joke",

217)212)

218print(response.output_text)213print(response.output_text)

219 214 

220second_response = client.responses.create(215second_response = client.responses.create(

221 model="gpt-4o-mini",216 model="gpt-5.5",

222 previous_response_id=response.id,217 previous_response_id=response.id,

223 input=[{"role": "user", "content": "explain why this is funny."}],218 input=[{"role": "user", "content": "explain why this is funny."}],

224)219)


237const openai = new OpenAI();232const openai = new OpenAI();

238 233 

239const response = await openai.responses.create({234const response = await openai.responses.create({

240 model: "gpt-4o-mini",235 model: "gpt-5.5",

241 input: "tell me a joke",236 input: "tell me a joke",

242 store: true,237 store: true,

243});238});


245console.log(response.output_text);240console.log(response.output_text);

246 241 

247const secondResponse = await openai.responses.create({242const secondResponse = await openai.responses.create({

248 model: "gpt-4o-mini",243 model: "gpt-5.5",

249 previous_response_id: response.id,244 previous_response_id: response.id,

250 input: [{"role": "user", "content": "explain why this is funny."}],245 input: [{"role": "user", "content": "explain why this is funny."}],

251 store: true,246 store: true,


259client = OpenAI()254client = OpenAI()

260 255 

261response = client.responses.create(256response = client.responses.create(

262 model="gpt-4o-mini",257 model="gpt-5.5",

263 input="tell me a joke",258 input="tell me a joke",

264)259)

265print(response.output_text)260print(response.output_text)

266 261 

267second_response = client.responses.create(262second_response = client.responses.create(

268 model="gpt-4o-mini",263 model="gpt-5.5",

269 previous_response_id=response.id,264 previous_response_id=response.id,

270 input=[{"role": "user", "content": "explain why this is funny."}],265 input=[{"role": "user", "content": "explain why this is funny."}],

271)266)

Details

35 super().__init__(data_store, file_store)35 super().__init__(data_store, file_store)

36 36 

37 assistant_agent = Agent[AgentContext](37 assistant_agent = Agent[AgentContext](

38 model="gpt-4.1",38 model="gpt-5.5",

39 name="Assistant",39 name="Assistant",

40 instructions="You are a helpful assistant",40 instructions="You are a helpful assistant",

41 )41 )


112 )112 )

113 113 

114assistant_agent = Agent[AgentContext](114assistant_agent = Agent[AgentContext](

115 model="gpt-4.1",115 model="gpt-5.5",

116 name="Assistant",116 name="Assistant",

117 instructions="You are a helpful assistant",117 instructions="You are a helpful assistant",

118 tools=[add_to_todo_list],118 tools=[add_to_todo_list],

Details

2 2 

3[Direct Preference Optimization](https://arxiv.org/abs/2305.18290) (DPO) fine-tuning allows you to fine-tune models based on prompts and pairs of responses. This approach enables the model to learn from more subjective human preferences, optimizing for outputs that are more likely to be favored. DPO is currently only supported for text inputs and outputs.3[Direct Preference Optimization](https://arxiv.org/abs/2305.18290) (DPO) fine-tuning allows you to fine-tune models based on prompts and pairs of responses. This approach enables the model to learn from more subjective human preferences, optimizing for outputs that are more likely to be favored. DPO is currently only supported for text inputs and outputs.

4 4 

5OpenAI is winding down the fine-tuning platform. The platform is no longer

6 accessible to new users, but existing users of the fine-tuning platform will

7 be able to create training jobs for the coming months.

8 <br />

9 All fine-tuned models will remain available for inference until their base

10 models are [deprecated](https://developers.openai.com/api/docs/deprecations). The full timeline is

11 [here](https://developers.openai.com/api/docs/deprecations).

12 

5<br />13<br />

6 14 

7<table>15<table>

Details

230 230 

231try:231try:

232 #Make your OpenAI API request here232 #Make your OpenAI API request here

233 response = client.chat.completions.create(233 response = client.responses.create(

234 prompt="Hello world",234 model="gpt-5.5",

235 model="gpt-4o-mini"235 input="Hello world"

236 )236 )

237except openai.APIError as e:237except openai.APIError as e:

238 #Handle API error here, e.g. retry or log238 #Handle API error here, e.g. retry or log

guides/evals.md +10 −3

Details

4 4 

5In this guide, we will focus on **configuring evals programmatically using the [Evals API](https://developers.openai.com/api/docs/api-reference/evals)**. If you prefer, you can also configure evals [in the OpenAI dashboard](https://platform.openai.com/evaluations).5In this guide, we will focus on **configuring evals programmatically using the [Evals API](https://developers.openai.com/api/docs/api-reference/evals)**. If you prefer, you can also configure evals [in the OpenAI dashboard](https://platform.openai.com/evaluations).

6 6 

7OpenAI is deprecating the Evals platform. Existing evals content remains

8 available during the transition window. Evals will become read-only for

9 existing users on October 31, 2026, and the platform is scheduled to shut down

10 on November 30, 2026. See the [deprecations

11 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-evals-platform) for the current

12 timeline.

13 

7If you're new to evaluations, or want a more iterative environment to14If you're new to evaluations, or want a more iterative environment to

8 experiment in as you build your eval, consider trying15 experiment in as you build your eval, consider trying

9 [Datasets](https://developers.openai.com/api/docs/guides/evaluation-getting-started) instead.16 [Datasets](https://developers.openai.com/api/docs/guides/evaluation-getting-started) instead.


30 -H "Authorization: Bearer $OPENAI_API_KEY" \\37 -H "Authorization: Bearer $OPENAI_API_KEY" \\

31 -H "Content-Type: application/json" \\38 -H "Content-Type: application/json" \\

32 -d '{39 -d '{

33 "model": "gpt-4.1",40 "model": "gpt-5.5",

34 "input": [41 "input": [

35 {42 {

36 "role": "developer",43 "role": "developer",


57const ticket = "My monitor won't turn on - help!";64const ticket = "My monitor won't turn on - help!";

58 65 

59const response = await client.responses.create({66const response = await client.responses.create({

60 model: "gpt-4.1",67 model: "gpt-5.5",

61 input: [68 input: [

62 { role: "developer", content: instructions },69 { role: "developer", content: instructions },

63 { role: "user", content: ticket },70 { role: "user", content: ticket },


80ticket = "My monitor won't turn on - help!"87ticket = "My monitor won't turn on - help!"

81 88 

82response = client.responses.create(89response = client.responses.create(

83 model="gpt-4.1",90 model="gpt-5.5",

84 input=[91 input=[

85 {"role": "developer", "content": instructions},92 {"role": "developer", "content": instructions},

86 {"role": "user", "content": ticket},93 {"role": "user", "content": ticket},

Details

4 4 

5This guide provides high-level guidance on designing evals. To get started with the [Evals API](https://developers.openai.com/api/docs/api-reference/evals), see [evaluating model performance](https://developers.openai.com/api/docs/guides/evals).5This guide provides high-level guidance on designing evals. To get started with the [Evals API](https://developers.openai.com/api/docs/api-reference/evals), see [evaluating model performance](https://developers.openai.com/api/docs/guides/evals).

6 6 

7OpenAI is deprecating the Evals platform. Existing evals content remains

8 available during the transition window. Evals will become read-only for

9 existing users on October 31, 2026, and the platform is scheduled to shut down

10 on November 30, 2026. See the [deprecations

11 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-evals-platform) for the current

12 timeline.

13 

7## What are evals?14## What are evals?

8 15 

9Evals are structured tests for measuring a model's performance. They help ensure accuracy, performance, and reliability, despite the nondeterministic nature of AI systems. They're also one of the only ways to _improve_ performance of an LLM-based application (through [fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)).16Evals are structured tests for measuring a model's performance. They help ensure accuracy, performance, and reliability, despite the nondeterministic nature of AI systems. They're also one of the only ways to _improve_ performance of an LLM-based application (through [fine-tuning](https://developers.openai.com/api/docs/guides/model-optimization)).


871. **Continuously evaluate**<br/>941. **Continuously evaluate**<br/>

88 Set up continuous evaluation (CE) to run evals on every change, monitor your app to identify new cases of nondeterminism, and grow the eval set over time.95 Set up continuous evaluation (CE) to run evals on every change, monitor your app to identify new cases of nondeterminism, and grow the eval set over time.

89 96 

90When creating an eval dataset, o3 and GPT-4.1 are useful for collecting eval97When creating an eval dataset,

91 examples and edge cases. Consider using o3 to help you generate a diverse set98 [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5)

92 of test data across various scenarios. Ensure your test data includes typical99 is useful for collecting eval examples and edge cases. Consider using it to

93 cases, edge cases, and adversarial cases. Use human expert labellers.100 help you generate a diverse set of test data across various scenarios. Ensure

101 your test data includes typical cases, edge cases, and adversarial cases. Use

102 human expert labellers.

94 103 

95## Identify where you need evals104## Identify where you need evals

96 105 


362 371 

363### LLM-as-a-judge and model graders372### LLM-as-a-judge and model graders

364 373 

365Using models to judge output is cheaper to run and more scalable than human evaluation. Strong LLM judges like GPT-4.1 can match both controlled and crowdsourced human preferences, achieving over 80% agreement (the same level of agreement between humans).374Using models to judge output is cheaper to run and more scalable than human evaluation. Start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) when you need a strong LLM judge, then validate agreement against your human labels before optimizing for cost or latency.

366 375 

367- **Examples**:376- **Examples**:

368 - Pairwise comparison: Present the judge model with two responses and ask it to determine which one is better based on specific criteria377 - Pairwise comparison: Present the judge model with two responses and ask it to determine which one is better based on specific criteria


371- **Challenges**: Position bias (response order), verbosity bias (preferring longer responses)380- **Challenges**: Position bias (response order), verbosity bias (preferring longer responses)

372- **Recommendations**:381- **Recommendations**:

373 - Use pairwise comparison or pass/fail for more reliability382 - Use pairwise comparison or pass/fail for more reliability

374 - Use the most capable model to grade if you can (e.g., o3)—o-series models excel at auto-grading from rubics or from a collection of reference expert answers383 - Use the most capable model to grade if you can. Start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5), then validate whether a specialized reasoning model performs better for your rubric or reference-answer set

375 - Control for response lengths as LLMs bias towards longer responses in general384 - Control for response lengths as LLMs bias towards longer responses in general

376 - Add reasoning and chain-of-thought as reasoning before scoring improves eval performance385 - Add reasoning and chain-of-thought as reasoning before scoring improves eval performance

377 - Once the LLM judge reaches a point where it's faster, cheaper, and consistently agrees with human annotations, scale up386 - Once the LLM judge reaches a point where it's faster, cheaper, and consistently agrees with human annotations, scale up

Details

2 2 

3Evaluations (often called **evals**) test model outputs to ensure they meet your specified style and content criteria. Writing evals is an essential part of building reliable applications. [Datasets](https://platform.openai.com/evaluation/datasets), a feature of the OpenAI platform, provide a quick way to get started with evals and test prompts.3Evaluations (often called **evals**) test model outputs to ensure they meet your specified style and content criteria. Writing evals is an essential part of building reliable applications. [Datasets](https://platform.openai.com/evaluation/datasets), a feature of the OpenAI platform, provide a quick way to get started with evals and test prompts.

4 4 

5OpenAI is deprecating the Evals platform. Existing evals content remains

6 available during the transition window. Evals will become read-only for

7 existing users on October 31, 2026, and the platform is scheduled to shut down

8 on November 30, 2026. See the [deprecations

9 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-evals-platform) for the current

10 timeline.

11 

5If you need advanced features such as evaluation against external models, want12If you need advanced features such as evaluation against external models, want

6 to interact with your eval runs via API, or want to run evaluations on a13 to interact with your eval runs via API, or want to run evaluations on a

7 larger scale, consider using [Evals](https://developers.openai.com/api/docs/guides/evals) instead.14 larger scale, consider using [Evals](https://developers.openai.com/api/docs/guides/evals) instead.

Details

4 4 

5We support accessing **third-party models** (no API key required) and accessing **custom endpoints** (API key required).5We support accessing **third-party models** (no API key required) and accessing **custom endpoints** (API key required).

6 6 

7OpenAI is deprecating the Evals platform. Existing evals content remains

8 available during the transition window. Evals will become read-only for

9 existing users on October 31, 2026, and the platform is scheduled to shut down

10 on November 30, 2026. See the [deprecations

11 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-evals-platform) for the current

12 timeline.

13 

7## Third-party models14## Third-party models

8 15 

9In order to use third-party models, the following must be true:16In order to use third-party models, the following must be true:


72 79 

73<span slot="icon">80<span slot="icon">

74 </span>81 </span>

75 Uses Datasets to quickly build evals and interate on prompts.82 Uses Datasets to quickly build evals and iterate on prompts.

76 83 

77 84 

78</a>85</a>

Details

294 -H "Content-Type: application/json" \\294 -H "Content-Type: application/json" \\

295 -H "Authorization: Bearer $OPENAI_API_KEY" \\295 -H "Authorization: Bearer $OPENAI_API_KEY" \\

296 -d '{296 -d '{

297 "model": "gpt-5",297 "model": "gpt-5.5",

298 "input": [298 "input": [

299 {299 {

300 "role": "user",300 "role": "user",


323const base64String = data.toString("base64");323const base64String = data.toString("base64");

324 324 

325const response = await client.responses.create({325const response = await client.responses.create({

326 model: "gpt-5",326 model: "gpt-5.5",

327 input: [327 input: [

328 {328 {

329 role: "user",329 role: "user",


356base64_string = base64.b64encode(data).decode("utf-8")356base64_string = base64.b64encode(data).decode("utf-8")

357 357 

358response = client.responses.create(358response = client.responses.create(

359 model="gpt-5",359 model="gpt-5.5",

360 input=[360 input=[

361 {361 {

362 "role": "user",362 "role": "user",

Details

2 2 

3Graders are a way to evaluate your model's performance against reference answers. Our [graders API](https://developers.openai.com/api/docs/api-reference/graders) is a way to test your graders, experiment with results, and improve your fine-tuning or evaluation framework to get the results you want.3Graders are a way to evaluate your model's performance against reference answers. Our [graders API](https://developers.openai.com/api/docs/api-reference/graders) is a way to test your graders, experiment with results, and improve your fine-tuning or evaluation framework to get the results you want.

4 4 

5OpenAI is deprecating graders as part of the evals and fine-tuning workflows

6 they support. See the [deprecations page](https://developers.openai.com/api/docs/deprecations) for the

7 current transition timelines.

8 

5## Overview9## Overview

6 10 

7Graders let you compare reference answers to the corresponding model-generated answer and return a grade in the range from 0 to 1. It's sometimes helpful to give the model partial credit for an answer, rather than a binary 0 or 1.11Graders let you compare reference answers to the corresponding model-generated answer and return a grade in the range from 0 to 1. It's sometimes helpful to give the model partial credit for an answer, rather than a binary 0 or 1.

Details

29- If you only need to generate or edit a single image from one prompt, the Image API is your best choice.29- If you only need to generate or edit a single image from one prompt, the Image API is your best choice.

30- If you want to build conversational, editable image experiences with GPT Image, go with the Responses API.30- If you want to build conversational, editable image experiences with GPT Image, go with the Responses API.

31 31 

32With the Image API, you choose a GPT Image model directly. With the Responses API, you choose a mainline model that supports the image generation tool; the tool handles GPT Image model selection. Responses API requests include the mainline model's token usage in addition to image generation costs.

33 

32Both APIs let you [customize output](#customize-image-output) by adjusting quality, size, format, and compression. Transparent backgrounds depend on model support.34Both APIs let you [customize output](#customize-image-output) by adjusting quality, size, format, and compression. Transparent backgrounds depend on model support.

33 35 

34This guide focuses on GPT Image.36This guide focuses on GPT Image.


61 63 

62 64 

63 65 

64<div data-content-switcher-pane data-value="responses">66<div data-content-switcher-pane data-value="image">

65 <div class="hidden">Responses API</div>

66 Generate an image

67 

68```javascript

69import OpenAI from "openai";

70const openai = new OpenAI();

71 

72const response = await openai.responses.create({

73 model: "gpt-5.5",

74 input: "Generate an image of gray tabby cat hugging an otter with an orange scarf",

75 tools: [{type: "image_generation"}],

76});

77 

78// Save the image to a file

79const imageData = response.output

80 .filter((output) => output.type === "image_generation_call")

81 .map((output) => output.result);

82 

83if (imageData.length > 0) {

84 const imageBase64 = imageData[0];

85 const fs = await import("fs");

86 fs.writeFileSync("otter.png", Buffer.from(imageBase64, "base64"));

87}

88```

89 

90```python

91from openai import OpenAI

92import base64

93 

94client = OpenAI()

95 

96response = client.responses.create(

97 model="gpt-5.5",

98 input="Generate an image of gray tabby cat hugging an otter with an orange scarf",

99 tools=[{"type": "image_generation"}],

100)

101 

102# Save the image to a file

103image_data = [

104 output.result

105 for output in response.output

106 if output.type == "image_generation_call"

107]

108

109if image_data:

110 image_base64 = image_data[0]

111 with open("otter.png", "wb") as f:

112 f.write(base64.b64decode(image_base64))

113```

114 

115 </div>

116 <div data-content-switcher-pane data-value="image" hidden>

117 <div class="hidden">Image API</div>67 <div class="hidden">Image API</div>

118 Generate an image68 Generate an image

119 69 


180```130```

181 131 

182 </div>132 </div>

133 <div data-content-switcher-pane data-value="responses" hidden>

134 <div class="hidden">Responses API</div>

135 Generate an image

136 

137```javascript

138import OpenAI from "openai";

139const openai = new OpenAI();

140 

141const response = await openai.responses.create({

142 model: "gpt-5.5",

143 input: "Generate an image of gray tabby cat hugging an otter with an orange scarf",

144 tools: [{type: "image_generation"}],

145});

146 

147// Save the image to a file

148const imageData = response.output

149 .filter((output) => output.type === "image_generation_call")

150 .map((output) => output.result);

151 

152if (imageData.length > 0) {

153 const imageBase64 = imageData[0];

154 const fs = await import("fs");

155 fs.writeFileSync("otter.png", Buffer.from(imageBase64, "base64"));

156}

157```

158 

159```python

160from openai import OpenAI

161import base64

162 

163client = OpenAI()

164 

165response = client.responses.create(

166 model="gpt-5.5",

167 input="Generate an image of gray tabby cat hugging an otter with an orange scarf",

168 tools=[{"type": "image_generation"}],

169)

170 

171# Save the image to a file

172image_data = [

173 output.result

174 for output in response.output

175 if output.type == "image_generation_call"

176]

177

178if image_data:

179 image_base64 = image_data[0]

180 with open("otter.png", "wb") as f:

181 f.write(base64.b64decode(image_base64))

182```

183 

184 </div>

183 185 

184 186 

185 187 


781 783 

782```python784```python

783from openai import OpenAI785from openai import OpenAI

786import base64

787 

784client = OpenAI()788client = OpenAI()

785 789 

790def create_file(file_path):

791 with open(file_path, "rb") as file_content:

792 result = client.files.create(file=file_content, purpose="vision")

793 return result.id

794 

786fileId = create_file("sunlit_lounge.png")795fileId = create_file("sunlit_lounge.png")

787maskId = create_file("mask.png")796maskId = create_file("mask.png")

788 797 


827```836```

828 837 

829```javascript838```javascript

839import fs from "fs";

830import OpenAI from "openai";840import OpenAI from "openai";

841 

831const openai = new OpenAI();842const openai = new OpenAI();

832 843 

844async function createFile(filePath) {

845 const result = await openai.files.create({

846 file: fs.createReadStream(filePath),

847 purpose: "vision",

848 });

849 return result.id;

850}

851 

833const fileId = await createFile("sunlit_lounge.png");852const fileId = await createFile("sunlit_lounge.png");

834const maskId = await createFile("mask.png");853const maskId = await createFile("mask.png");

835 854 


867 886 

868if (imageData.length > 0) {887if (imageData.length > 0) {

869 const imageBase64 = imageData[0];888 const imageBase64 = imageData[0];

870 const fs = await import("fs");

871 fs.writeFileSync("lounge.png", Buffer.from(imageBase64, "base64"));889 fs.writeFileSync("lounge.png", Buffer.from(imageBase64, "base64"));

872}890}

873```891```


879 897 

880```python898```python

881from openai import OpenAI899from openai import OpenAI

900import base64

901 

882client = OpenAI()902client = OpenAI()

883 903 

884result = client.images.edit(904result = client.images.edit(


971from io import BytesIO991from io import BytesIO

972 992 

973# 1. Load your black & white mask as a grayscale image993# 1. Load your black & white mask as a grayscale image

974mask = Image.open(img_path_mask).convert("L")994mask = Image.open("mask.png").convert("L")

975 995 

976# 2. Convert it to RGBA so it has space for an alpha channel996# 2. Convert it to RGBA so it has space for an alpha channel

977mask_rgba = mask.convert("RGBA")997mask_rgba = mask.convert("RGBA")

Details

37const openai = new OpenAI();37const openai = new OpenAI();

38 38 

39const response = await openai.responses.create({39const response = await openai.responses.create({

40 model: "gpt-4.1-mini",40 model: "gpt-5.5",

41 input: "Generate an image of gray tabby cat hugging an otter with an orange scarf",41 input: "Generate an image of gray tabby cat hugging an otter with an orange scarf",

42 tools: [{type: "image_generation"}],42 tools: [{type: "image_generation"}],

43});43});


61client = OpenAI() 61client = OpenAI()

62 62 

63response = client.responses.create(63response = client.responses.create(

64 model="gpt-4.1-mini",64 model="gpt-5.5",

65 input="Generate an image of gray tabby cat hugging an otter with an orange scarf",65 input="Generate an image of gray tabby cat hugging an otter with an orange scarf",

66 tools=[{"type": "image_generation"}],66 tools=[{"type": "image_generation"}],

67)67)


132const openai = new OpenAI();132const openai = new OpenAI();

133 133 

134const response = await openai.responses.create({134const response = await openai.responses.create({

135 model: "gpt-4.1-mini",135 model: "gpt-5.5",

136 input: [{136 input: [{

137 role: "user",137 role: "user",

138 content: [138 content: [


154client = OpenAI()154client = OpenAI()

155 155 

156response = client.responses.create(156response = client.responses.create(

157 model="gpt-4.1-mini",157 model="gpt-5.5",

158 input=[{158 input=[{

159 "role": "user",159 "role": "user",

160 "content": [160 "content": [


174using OpenAI.Responses;174using OpenAI.Responses;

175 175 

176string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;176string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

177OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);177OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

178 178 

179Uri imageUrl = new("https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg");179Uri imageUrl = new("https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg");

180 180 


193 -H "Content-Type: application/json" \\193 -H "Content-Type: application/json" \\

194 -H "Authorization: Bearer $OPENAI_API_KEY" \\194 -H "Authorization: Bearer $OPENAI_API_KEY" \\

195 -d '{195 -d '{

196 "model": "gpt-4.1-mini",196 "model": "gpt-5.5",

197 "input": [197 "input": [

198 {198 {

199 "role": "user",199 "role": "user",


239const base64Image = fs.readFileSync(imagePath, "base64");239const base64Image = fs.readFileSync(imagePath, "base64");

240 240 

241const response = await openai.responses.create({241const response = await openai.responses.create({

242 model: "gpt-4.1-mini",242 model: "gpt-5.5",

243 input: [243 input: [

244 {244 {

245 role: "user",245 role: "user",


277 277 

278 278 

279response = client.responses.create(279response = client.responses.create(

280 model="gpt-4.1",280 model="gpt-5.5",

281 input=[281 input=[

282 {282 {

283 "role": "user",283 "role": "user",


299using OpenAI.Responses;299using OpenAI.Responses;

300 300 

301string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;301string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

302OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);302OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

303 303 

304Uri imageUrl = new("https://openai-documentation.vercel.app/images/cat_and_otter.png");304Uri imageUrl = new("https://openai-documentation.vercel.app/images/cat_and_otter.png");

305using HttpClient http = new();305using HttpClient http = new();


354const fileId = await createFile("path_to_your_image.jpg");354const fileId = await createFile("path_to_your_image.jpg");

355 355 

356const response = await openai.responses.create({356const response = await openai.responses.create({

357 model: "gpt-4.1-mini",357 model: "gpt-5.5",

358 input: [358 input: [

359 {359 {

360 role: "user",360 role: "user",


390file_id = create_file("path_to_your_image.jpg")390file_id = create_file("path_to_your_image.jpg")

391 391 

392response = client.responses.create(392response = client.responses.create(

393 model="gpt-4.1-mini",393 model="gpt-5.5",

394 input=[{394 input=[{

395 "role": "user",395 "role": "user",

396 "content": [396 "content": [


411using OpenAI.Responses;411using OpenAI.Responses;

412 412 

413string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;413string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

414OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);414OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

415 415 

416string filename = "cat_and_otter.png";416string filename = "cat_and_otter.png";

417Uri imageUrl = new($"https://openai-documentation.vercel.app/images/{filename}");417Uri imageUrl = new($"https://openai-documentation.vercel.app/images/{filename}");

guides/ip-addresses.md +14 −0 created

Details

1# IP egress ranges

2 

3Some OpenAI products make outbound requests to services you control. If your network requires an IP allowlist, use the published ranges for the product making the request.

4 

5IP allowlisting identifies traffic from an OpenAI-operated network, not a specific user or workspace, and does not replace request authentication or authorization when your integration requires them. For ChatGPT apps, use [mutual TLS](https://developers.openai.com/apps-sdk/build/auth#mutual-tls-mtls) to authenticate ChatGPT as the MCP client. When your app requires user authentication, use OAuth 2.1 to authenticate and authorize the user.

6 

7## Outbound IP addresses

8 

9| Product | Used for | Published ranges |

10| -------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------- |

11| ChatGPT integrations | Apps built with the Apps SDK, connectors, GPT Actions, and Agentic Commerce | [chatgpt-connectors.json](https://openai.com/chatgpt-connectors.json) |

12| Codex cloud | Connections from Codex cloud to services such as GitHub | [chatgpt-agents.json](https://openai.com/chatgpt-agents.json) |

13 

14Each JSON file includes a `creationTime` and a `prefixes` array. The ranges can change as OpenAI infrastructure changes. Fetch the relevant file regularly and update your allowlist automatically.

Details

71Responses are stored by default. Chat completions are stored by default for new accounts.71Responses are stored by default. Chat completions are stored by default for new accounts.

72To disable storage when using either API, set `store: false`.72To disable storage when using either API, set `store: false`.

73 73 

74The objects you recieve back from these APIs will differ slightly. In Chat Completions, you receive an array of74The objects you receive back from these APIs will differ slightly. In Chat Completions, you receive an array of

75`choices`, each containing a `message`. In Responses, you receive an array of Items labled `output`.75`choices`, each containing a `message`. In Responses, you receive an array of Items labeled `output`.

76 76 

77### Additional differences77### Additional differences

78 78 


103 -H "Content-Type: application/json" \\103 -H "Content-Type: application/json" \\

104 -H "Authorization: Bearer $OPENAI_API_KEY" \\104 -H "Authorization: Bearer $OPENAI_API_KEY" \\

105 -d "{105 -d "{

106 \\"model\\": \\"gpt-5\\",106 \\"model\\": \\"gpt-5.5\\",

107 \\"messages\\": $INPUT107 \\"messages\\": $INPUT

108 }"108 }"

109 109 


111 -H "Content-Type: application/json" \\111 -H "Content-Type: application/json" \\

112 -H "Authorization: Bearer $OPENAI_API_KEY" \\112 -H "Authorization: Bearer $OPENAI_API_KEY" \\

113 -d "{113 -d "{

114 \\"model\\": \\"gpt-5\\",114 \\"model\\": \\"gpt-5.5\\",

115 \\"input\\": $INPUT115 \\"input\\": $INPUT

116 }"116 }"

117```117```


123];123];

124 124 

125const completion = await client.chat.completions.create({125const completion = await client.chat.completions.create({

126 model: 'gpt-5',126 model: 'gpt-5.5',

127 messages: messages127 messages: context

128});128});

129 129 

130const response = await client.responses.create({130const response = await client.responses.create({

131 model: "gpt-5",131 model: "gpt-5.5",

132 input: context132 input: context

133});133});

134```134```


140]140]

141 141 

142completion = client.chat.completions.create(142completion = client.chat.completions.create(

143 model="gpt-5",143 model="gpt-5.5",

144 messages=messages144 messages=context

145)145)

146 146 

147response = client.responses.create(147response = client.responses.create(

148 model="gpt-5",148 model="gpt-5.5",

149 input=context149 input=context

150)150)

151```151```


165const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });165const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

166 166 

167const completion = await client.chat.completions.create({167const completion = await client.chat.completions.create({

168 model: 'gpt-5',168 model: 'gpt-5.5',

169 messages: [169 messages: [

170 { 'role': 'system', 'content': 'You are a helpful assistant.' },170 { 'role': 'system', 'content': 'You are a helpful assistant.' },

171 { 'role': 'user', 'content': 'Hello!' }171 { 'role': 'user', 'content': 'Hello!' }


179client = OpenAI()179client = OpenAI()

180 180 

181completion = client.chat.completions.create(181completion = client.chat.completions.create(

182 model="gpt-5",182 model="gpt-5.5",

183 messages=[183 messages=[

184 {"role": "system", "content": "You are a helpful assistant."},184 {"role": "system", "content": "You are a helpful assistant."},

185 {"role": "user", "content": "Hello!"}185 {"role": "user", "content": "Hello!"}


193 -H "Content-Type: application/json" \\193 -H "Content-Type: application/json" \\

194 -H "Authorization: Bearer $OPENAI_API_KEY" \\194 -H "Authorization: Bearer $OPENAI_API_KEY" \\

195 -d '{195 -d '{

196 "model": "gpt-5",196 "model": "gpt-5.5",

197 "messages": [197 "messages": [

198 {"role": "system", "content": "You are a helpful assistant."},198 {"role": "system", "content": "You are a helpful assistant."},

199 {"role": "user", "content": "Hello!"}199 {"role": "user", "content": "Hello!"}


216const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });216const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

217 217 

218const response = await client.responses.create({218const response = await client.responses.create({

219 model: 'gpt-5',219 model: 'gpt-5.5',

220 instructions: 'You are a helpful assistant.',220 instructions: 'You are a helpful assistant.',

221 input: 'Hello!'221 input: 'Hello!'

222});222});


229client = OpenAI()229client = OpenAI()

230 230 

231response = client.responses.create(231response = client.responses.create(

232 model="gpt-5",232 model="gpt-5.5",

233 instructions="You are a helpful assistant.",233 instructions="You are a helpful assistant.",

234 input="Hello!"234 input="Hello!"

235)235)


241 -H "Content-Type: application/json" \\241 -H "Content-Type: application/json" \\

242 -H "Authorization: Bearer $OPENAI_API_KEY" \\242 -H "Authorization: Bearer $OPENAI_API_KEY" \\

243 -d '{243 -d '{

244 "model": "gpt-5",244 "model": "gpt-5.5",

245 "instructions": "You are a helpful assistant.",245 "instructions": "You are a helpful assistant.",

246 "input": "Hello!"246 "input": "Hello!"

247 }'247 }'


269const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });269const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

270 270 

271const completion = await client.chat.completions.create({271const completion = await client.chat.completions.create({

272 model: 'gpt-5',272 model: 'gpt-5.5',

273 messages: [273 messages: [

274 { 'role': 'system', 'content': 'You are a helpful assistant.' },274 { 'role': 'system', 'content': 'You are a helpful assistant.' },

275 { 'role': 'user', 'content': 'Hello!' }275 { 'role': 'user', 'content': 'Hello!' }


283client = OpenAI()283client = OpenAI()

284 284 

285completion = client.chat.completions.create(285completion = client.chat.completions.create(

286 model="gpt-5",286 model="gpt-5.5",

287 messages=[287 messages=[

288 {"role": "system", "content": "You are a helpful assistant."},288 {"role": "system", "content": "You are a helpful assistant."},

289 {"role": "user", "content": "Hello!"}289 {"role": "user", "content": "Hello!"}


297 -H "Content-Type: application/json" \\297 -H "Content-Type: application/json" \\

298 -H "Authorization: Bearer $OPENAI_API_KEY" \\298 -H "Authorization: Bearer $OPENAI_API_KEY" \\

299 -d '{299 -d '{

300 "model": "gpt-5",300 "model": "gpt-5.5",

301 "messages": [301 "messages": [

302 {"role": "system", "content": "You are a helpful assistant."},302 {"role": "system", "content": "You are a helpful assistant."},

303 {"role": "user", "content": "Hello!"}303 {"role": "user", "content": "Hello!"}


320const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });320const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

321 321 

322const response = await client.responses.create({322const response = await client.responses.create({

323 model: 'gpt-5',323 model: 'gpt-5.5',

324 instructions: 'You are a helpful assistant.',324 instructions: 'You are a helpful assistant.',

325 input: 'Hello!'325 input: 'Hello!'

326});326});


333client = OpenAI()333client = OpenAI()

334 334 

335response = client.responses.create(335response = client.responses.create(

336 model="gpt-5",336 model="gpt-5.5",

337 instructions="You are a helpful assistant.",337 instructions="You are a helpful assistant.",

338 input="Hello!"338 input="Hello!"

339)339)


345 -H "Content-Type: application/json" \\345 -H "Content-Type: application/json" \\

346 -H "Authorization: Bearer $OPENAI_API_KEY" \\346 -H "Authorization: Bearer $OPENAI_API_KEY" \\

347 -d '{347 -d '{

348 "model": "gpt-5",348 "model": "gpt-5.5",

349 "instructions": "You are a helpful assistant.",349 "instructions": "You are a helpful assistant.",

350 "input": "Hello!"350 "input": "Hello!"

351 }'351 }'


376 { 'role': 'user', 'content': 'What is the capital of France?' }376 { 'role': 'user', 'content': 'What is the capital of France?' }

377 ];377 ];

378const res1 = await client.chat.completions.create({378const res1 = await client.chat.completions.create({

379 model: 'gpt-5',379 model: 'gpt-5.5',

380 messages380 messages

381});381});

382 382 


384messages.push({ 'role': 'user', 'content': 'And its population?' });384messages.push({ 'role': 'user', 'content': 'And its population?' });

385 385 

386const res2 = await client.chat.completions.create({386const res2 = await client.chat.completions.create({

387 model: 'gpt-5',387 model: 'gpt-5.5',

388 messages388 messages

389});389});

390```390```


394 {"role": "system", "content": "You are a helpful assistant."},394 {"role": "system", "content": "You are a helpful assistant."},

395 {"role": "user", "content": "What is the capital of France?"}395 {"role": "user", "content": "What is the capital of France?"}

396]396]

397res1 = client.chat.completions.create(model="gpt-5", messages=messages)397res1 = client.chat.completions.create(model="gpt-5.5", messages=messages)

398 398 

399messages += [res1.choices[0].message]399messages += [res1.choices[0].message]

400messages += [{"role": "user", "content": "And its population?"}]400messages += [{"role": "user", "content": "And its population?"}]

401 401 

402res2 = client.chat.completions.create(model="gpt-5", messages=messages)402res2 = client.chat.completions.create(model="gpt-5.5", messages=messages)

403```403```

404 404 

405 </>405 </>


414 414 

415```python415```python

416context = [416context = [

417 { "role": "role", "content": "What is the capital of France?" }417 { "role": "user", "content": "What is the capital of France?" }

418]418]

419res1 = client.responses.create(419res1 = client.responses.create(

420 model="gpt-5",420 model="gpt-5.5",

421 input=context,421 input=context,

422)422)

423 423 

424// Append the first responses output to context424# Append the first response's output to context

425context += res1.output425context += res1.output

426 426 

427// Add the next user message427# Add the next user message

428context += [428context += [

429 { "role": "role", "content": "And it's population?" }429 { "role": "user", "content": "And its population?" }

430]430]

431 431 

432res2 = client.responses.create(432res2 = client.responses.create(

433 model="gpt-5",433 model="gpt-5.5",

434 input=context,434 input=context,

435)435)

436```436```

437 437 

438```javascript438```javascript

439let context = [439let context = [

440 { role: "role", content: "What is the capital of France?" }440 { role: "user", content: "What is the capital of France?" }

441];441];

442 442 

443const res1 = await client.responses.create({443const res1 = await client.responses.create({

444 model: "gpt-5",444 model: "gpt-5.5",

445 input: context,445 input: context,

446});446});

447 447 


449context = context.concat(res1.output);449context = context.concat(res1.output);

450 450 

451// Add the next user message451// Add the next user message

452context.push({ role: "role", content: "And its population?" });452context.push({ role: "user", content: "And its population?" });

453 453 

454const res2 = await client.responses.create({454const res2 = await client.responses.create({

455 model: "gpt-5",455 model: "gpt-5.5",

456 input: context,456 input: context,

457});457});

458```458```


465 465 

466```javascript466```javascript

467const res1 = await client.responses.create({467const res1 = await client.responses.create({

468 model: 'gpt-5',468 model: 'gpt-5.5',

469 input: 'What is the capital of France?',469 input: 'What is the capital of France?',

470 store: true470 store: true

471});471});

472 472 

473const res2 = await client.responses.create({473const res2 = await client.responses.create({

474 model: 'gpt-5',474 model: 'gpt-5.5',

475 input: 'And its population?',475 input: 'And its population?',

476 previous_response_id: res1.id,476 previous_response_id: res1.id,

477 store: true477 store: true


480 480 

481```python481```python

482res1 = client.responses.create(482res1 = client.responses.create(

483 model="gpt-5",483 model="gpt-5.5",

484 input="What is the capital of France?",484 input="What is the capital of France?",

485 store=True485 store=True

486)486)

487 487 

488res2 = client.responses.create(488res2 = client.responses.create(

489 model="gpt-5",489 model="gpt-5.5",

490 input="And its population?",490 input="And its population?",

491 previous_response_id=res1.id,491 previous_response_id=res1.id,

492 store=True492 store=True


540 -H "Content-Type: application/json" \\540 -H "Content-Type: application/json" \\

541 -H "Authorization: Bearer $OPENAI_API_KEY" \\541 -H "Authorization: Bearer $OPENAI_API_KEY" \\

542 -d '{542 -d '{

543 "model": "gpt-5",543 "model": "gpt-5.5",

544 "messages": [544 "messages": [

545 {545 {

546 "role": "user",546 "role": "user",

547 "content": "Jane, 54 years old",547 "content": "Jane, 54 years old"

548 }548 }

549 ],549 ],

550 "response_format": {550 "response_format": {


573 }573 }

574 }574 }

575 },575 },

576 "verbosity": "medium",

577 "reasoning_effort": "medium"576 "reasoning_effort": "medium"

578}'577}'

579```578```


583client = OpenAI()582client = OpenAI()

584 583 

585response = client.chat.completions.create(584response = client.chat.completions.create(

586 model="gpt-5",585 model="gpt-5.5",

587 messages=[586 messages=[

588 {587 {

589 "role": "user",588 "role": "user",


616 }615 }

617 }616 }

618 },617 },

619 verbosity="medium",

620 reasoning_effort="medium"618 reasoning_effort="medium"

621)619)

622```620```

623 621 

624```javascript622```javascript

625const completion = await openai.chat.completions.create({623const completion = await openai.chat.completions.create({

626 model: "gpt-5",624 model: "gpt-5.5",

627 messages: [625 messages: [

628 {626 {

629 "role": "user",627 "role": "user",


649 }647 }

650 },648 },

651 required: [649 required: [

652 name,650 "name",

653 age651 "age"

654 ],652 ],

655 additionalProperties: false653 additionalProperties: false

656 }654 }

657 }655 }

658 },656 },

659 verbosity: "medium",

660 reasoning_effort: "medium"657 reasoning_effort: "medium"

661});658});

662```659```


671 -H "Content-Type: application/json" \\668 -H "Content-Type: application/json" \\

672 -H "Authorization: Bearer $OPENAI_API_KEY" \\669 -H "Authorization: Bearer $OPENAI_API_KEY" \\

673 -d '{670 -d '{

674 "model": "gpt-5",671 "model": "gpt-5.5",

675 "input": "Jane, 54 years old",672 "input": "Jane, 54 years old",

676 "text": {673 "text": {

677 "format": {674 "format": {


704 701 

705```python702```python

706response = client.responses.create(703response = client.responses.create(

707 model="gpt-5",704 model="gpt-5.5",

708 input="Jane, 54 years old", 705 input="Jane, 54 years old",

709 text={706 text={

710 "format": {707 "format": {


737 734 

738```javascript735```javascript

739const response = await openai.responses.create({736const response = await openai.responses.create({

740 model: "gpt-5",737 model: "gpt-5.5",

741 input: "Jane, 54 years old",738 input: "Jane, 54 years old",

742 text: {739 text: {

743 format: {740 format: {


758 }755 }

759 },756 },

760 required: [757 required: [

761 name,758 "name",

762 age759 "age"

763 ],760 ],

764 additionalProperties: false761 additionalProperties: false

765 }762 }


793}790}

794 791 

795const completion = await client.chat.completions.create({792const completion = await client.chat.completions.create({

796 model: 'gpt-5',793 model: 'gpt-5.5',

797 messages: [794 messages: [

798 { role: 'system', content: 'You are a helpful assistant.' },795 { role: 'system', content: 'You are a helpful assistant.' },

799 { role: 'user', content: 'Who is the current president of France?' }796 { role: 'user', content: 'Who is the current president of France?' }


820 return r.json().get("results", [])817 return r.json().get("results", [])

821 818 

822completion = client.chat.completions.create(819completion = client.chat.completions.create(

823 model="gpt-5",820 model="gpt-5.5",

824 messages=[821 messages=[

825 {"role": "system", "content": "You are a helpful assistant."},822 {"role": "system", "content": "You are a helpful assistant."},

826 {"role": "user", "content": "Who is the current president of France?"}823 {"role": "user", "content": "Who is the current president of France?"}


894 891 

895## Incremental migration892## Incremental migration

896 893 

897The Responses API is a superset of the Chat Completions API. The Chat Completions API will also continue to be supported. As such, you can incrementally adopt the Responses API if desired. You can migrate user flows who would benefit from improved reasoning models to the Responses API while keeping other flows on the Chat Completions API until you're ready for a full migration.894The Responses API is a superset of the Chat Completions API, and Chat Completions remains supported. You can migrate one user flow at a time:

895 

8961. Start with a simple text-generation flow and update the endpoint, input, and output handling.

8972. Update multi-turn state management, then migrate function calling and Structured Outputs.

8983. For streaming flows, update consumers to handle typed Responses events such as `response.output_text.delta`. See the [streaming Responses guide](https://developers.openai.com/api/docs/guides/streaming-responses?api-mode=responses).

8994. Compare behavior, latency, and errors before routing more traffic to Responses.

898 900 

899As a best practice, we encourage all users to migrate to the Responses API to take advantage of the latest features and improvements from OpenAI.901We recommend migrating all flows to the Responses API over time to take advantage of the latest OpenAI features and improvements.

900 902 

901## Assistants API903## Assistants API

902 904 

Details

15 15 

16 16 

17 17 

18 

18LLM output is non-deterministic, and model behavior changes between model snapshots and families. Developers must constantly measure and tune the performance of LLM applications to ensure they're getting the best results. In this guide, we explore the techniques and OpenAI platform tools you can use to ensure high quality outputs from the model.19LLM output is non-deterministic, and model behavior changes between model snapshots and families. Developers must constantly measure and tune the performance of LLM applications to ensure they're getting the best results. In this guide, we explore the techniques and OpenAI platform tools you can use to ensure high quality outputs from the model.

19 20 

21This guide covers evals and fine-tuning workflows that are being moved into

22 legacy documentation. See the [deprecations page](https://developers.openai.com/api/docs/deprecations) for

23 the current timelines for the affected platform surfaces.

24 

20<div className="my-4 w-full max-w-full overflow-hidden">25<div className="my-4 w-full max-w-full overflow-hidden">

21 </div>26 </div>

22 27 


52With evals in place, you can effectively iterate on [prompts](https://developers.openai.com/api/docs/guides/text). The prompt engineering process may be all you need in order to get great results for your use case. Different models may require different prompting techniques, but there are several best practices you can apply across the board to get better results.57With evals in place, you can effectively iterate on [prompts](https://developers.openai.com/api/docs/guides/text). The prompt engineering process may be all you need in order to get great results for your use case. Different models may require different prompting techniques, but there are several best practices you can apply across the board to get better results.

53 58 

54- **Include relevant context** - in your instructions, include text or image content that the model will need to generate a response from outside its training data. This could include data from private databases or current, up-to-the-minute information.59- **Include relevant context** - in your instructions, include text or image content that the model will need to generate a response from outside its training data. This could include data from private databases or current, up-to-the-minute information.

55- **Provide clear instructions** - your prompt should contain clear goals about what kind of output you want. GPT models like `gpt-4.1` are great at following very explicit instructions, while [reasoning models](https://developers.openai.com/api/docs/guides/reasoning) like `o4-mini` tend to do better with high level guidance on outcomes.60- **Provide clear instructions** - your prompt should contain clear goals about what kind of output you want. Start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) for new work, and use [reasoning model guidance](https://developers.openai.com/api/docs/guides/reasoning) to tune outcome-level instructions, reasoning effort, and verbosity.

56- **Provide example outputs** - give the model a few examples of correct output for a given prompt (a process called few-shot learning). The model can extrapolate from these examples how it should respond for other prompts.61- **Provide example outputs** - give the model a few examples of correct output for a given prompt (a process called few-shot learning). The model can extrapolate from these examples how it should respond for other prompts.

57 62 

58[63[

Details

1# Model selection1# Model selection

2 2 

3Choosing the right model, whether GPT-4o or a smaller option like GPT-4o-mini, requires balancing **accuracy**, **latency**, and **cost**. This guide explains key principles to help you make informed decisions, along with a practical example.3Choosing the right model, whether [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) or a smaller option like [`gpt-5.4-mini`](https://developers.openai.com/api/docs/models/gpt-5.4-mini), requires balancing **accuracy**, **latency**, and **cost**. This guide explains key principles to help you make informed decisions, along with a practical example.

4 4 

5## Core principles5## Core principles

6 6 


57 57 

58## Practical example58## Practical example

59 59 

60To demonstrate these principles, we'll develop a fake news classifier with the following target metrics:60To demonstrate these principles, we'll develop a fake news classifier with the following target metrics. The experiment below uses historical GPT-4o-family results to show the workflow; for current evaluations, start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) and compare against smaller or fine-tuned models.

61 61 

62- **Accuracy:** Achieve 90% correct classification62- **Accuracy:** Achieve 90% correct classification

63- **Cost:** Spend less than $5 per 1,000 articles63- **Cost:** Spend less than $5 per 1,000 articles


81 81 

82By switching from `gpt-4o` to `gpt-4o-mini` with fine-tuning, we achieved **equivalent performance for less than 2%** of the cost, using only 1,000 labeled examples.82By switching from `gpt-4o` to `gpt-4o-mini` with fine-tuning, we achieved **equivalent performance for less than 2%** of the cost, using only 1,000 labeled examples.

83 83 

84This process is important - you often can’t jump right to fine-tuning because you don’t know whether fine-tuning is the right tool for the optimization you need, or you don’t have enough labeled examples. Use `gpt-4o` to achieve your accuracy targets, and curate a good training set - then go for a smaller, more efficient model with fine-tuning.

84This process is important - you often can’t jump right to fine-tuning because you don’t know whether fine-tuning is the right tool for the optimization you need, or you don’t have enough labeled examples. Start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5) to establish your accuracy target, then test smaller or fine-tuned models when cost and latency matter.

Details

1# Node reference1# Node reference

2 2 

3[Agent Builder](https://platform.openai.com/agent-builder) is a visual canvas for composing agentic worfklows. Workflows are made up of nodes and connections that control the sequence and flow. Insert nodes, then configure and connect them to define the process you want your agents to follow.3[Agent Builder](https://platform.openai.com/agent-builder) is a visual canvas for composing agentic workflows. Workflows are made up of nodes and connections that control the sequence and flow. Insert nodes, then configure and connect them to define the process you want your agents to follow.

4 

5OpenAI is deprecating Agent Builder. Existing users can continue using it

6 during the transition window, and the product is scheduled to shut down on

7 November 30, 2026. ChatKit remains available. See the [deprecations

8 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-agent-builder) for the current

9 timeline.

4 10 

5Explore all available nodes below. To learn more, read the [Agent Builder guide](https://developers.openai.com/api/docs/guides/agent-builder).11Explore all available nodes below. To learn more, read the [Agent Builder guide](https://developers.openai.com/api/docs/guides/agent-builder).

6 12 

Details

17 -H "Authorization: Bearer $OPENAI_API_KEY" \17 -H "Authorization: Bearer $OPENAI_API_KEY" \

18 -H "Content-Type: application/json" \18 -H "Content-Type: application/json" \

19 -d '{19 -d '{

20 "model": "gpt-5",20 "model": "gpt-5.5",

21 "input": "What does 'fit check for my napalm era' mean?",21 "input": "What does 'fit check for my napalm era' mean?",

22 "service_tier": "priority"22 "service_tier": "priority"

23 }'23 }'


29const openai = new OpenAI();29const openai = new OpenAI();

30 30 

31const response = await openai.responses.create({31const response = await openai.responses.create({

32 model: "gpt-5",32 model: "gpt-5.5",

33 input: "What does 'fit check for my napalm era' mean?",33 input: "What does 'fit check for my napalm era' mean?",

34 service_tier: "priority"34 service_tier: "priority"

35});35});


43client = OpenAI()43client = OpenAI()

44 44 

45response = client.responses.create(45response = client.responses.create(

46 model="gpt-5",46 model="gpt-5.5",

47 input="What does 'fit check for my napalm era' mean?",47 input="What does 'fit check for my napalm era' mean?",

48 service_tier="priority"48 service_tier="priority"

49)49)

Details

73const client = new OpenAI();73const client = new OpenAI();

74 74 

75const response = await client.responses.create({75const response = await client.responses.create({

76 model: "gpt-5",76 model: "gpt-5.5",

77 reasoning: { effort: "low" },77 reasoning: { effort: "low" },

78 instructions: "${semicolonsDevMsg}",78 instructions: "${semicolonsDevMsg}",

79 input: "${semicolonsPrompt}",79 input: "${semicolonsPrompt}",


87client = OpenAI()87client = OpenAI()

88 88 

89response = client.responses.create(89response = client.responses.create(

90 model="gpt-5",90 model="gpt-5.5",

91 reasoning={"effort": "low"},91 reasoning={"effort": "low"},

92 instructions="${semicolonsDevMsg}",92 instructions="${semicolonsDevMsg}",

93 input="${semicolonsPrompt}",93 input="${semicolonsPrompt}",


101 -H "Content-Type: application/json" \\101 -H "Content-Type: application/json" \\

102 -H "Authorization: Bearer $OPENAI_API_KEY" \\102 -H "Authorization: Bearer $OPENAI_API_KEY" \\

103 -d '{103 -d '{

104 "model": "gpt-5",104 "model": "gpt-5.5",

105 "reasoning": {"effort": "low"},105 "reasoning": {"effort": "low"},

106 "instructions": "${semicolonsDevMsg}",106 "instructions": "${semicolonsDevMsg}",

107 "input": "${semicolonsPrompt}"107 "input": "${semicolonsPrompt}"


118const client = new OpenAI();118const client = new OpenAI();

119 119 

120const response = await client.responses.create({120const response = await client.responses.create({

121 model: "gpt-5",121 model: "gpt-5.5",

122 reasoning: { effort: "low" },122 reasoning: { effort: "low" },

123 input: [123 input: [

124 {124 {


140client = OpenAI()140client = OpenAI()

141 141 

142response = client.responses.create(142response = client.responses.create(

143 model="gpt-5",143 model="gpt-5.5",

144 reasoning={"effort": "low"},144 reasoning={"effort": "low"},

145 input=[145 input=[

146 {146 {


162 -H "Content-Type: application/json" \\162 -H "Content-Type: application/json" \\

163 -H "Authorization: Bearer $OPENAI_API_KEY" \\163 -H "Authorization: Bearer $OPENAI_API_KEY" \\

164 -d '{164 -d '{

165 "model": "gpt-5",165 "model": "gpt-5.5",

166 "reasoning": {"effort": "low"},166 "reasoning": {"effort": "low"},

167 "input": [167 "input": [

168 {168 {


201 201 

202In the OpenAI dashboard, you can develop reusable [prompts](https://platform.openai.com/chat/edit) that you can use in API requests, rather than specifying the content of prompts in code. This way, you can more easily build and evaluate your prompts, and deploy improved versions of your prompts without changing your integration code.202In the OpenAI dashboard, you can develop reusable [prompts](https://platform.openai.com/chat/edit) that you can use in API requests, rather than specifying the content of prompts in code. This way, you can more easily build and evaluate your prompts, and deploy improved versions of your prompts without changing your integration code.

203 203 

204OpenAI is deprecating reusable prompt objects in the API. Prompt creation will

205 be de-emphasized beginning June 3, 2026, and `v1/prompts` is scheduled to shut

206 down on November 30, 2026. See the [deprecations

207 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-reusable-prompts) for the current

208 timeline.

209 

204 210 

205 211 

206 212 


224const client = new OpenAI();230const client = new OpenAI();

225 231 

226const response = await client.responses.create({232const response = await client.responses.create({

227 model: "gpt-5",233 model: "gpt-5.5",

228 prompt: {234 prompt: {

229 id: "pmpt_abc123",235 id: "pmpt_abc123",

230 version: "2",236 version: "2",


243client = OpenAI()249client = OpenAI()

244 250 

245response = client.responses.create(251response = client.responses.create(

246 model="gpt-5",252 model="gpt-5.5",

247 prompt={253 prompt={

248 "id": "pmpt_abc123",254 "id": "pmpt_abc123",

249 "version": "2",255 "version": "2",


262 -H "Authorization: Bearer $OPENAI_API_KEY" \\268 -H "Authorization: Bearer $OPENAI_API_KEY" \\

263 -H "Content-Type: application/json" \\269 -H "Content-Type: application/json" \\

264 -d '{270 -d '{

265 "model": "gpt-5",271 "model": "gpt-5.5",

266 "prompt": {272 "prompt": {

267 "id": "pmpt_abc123",273 "id": "pmpt_abc123",

268 "version": "2",274 "version": "2",


291});297});

292 298 

293const response = await client.responses.create({299const response = await client.responses.create({

294 model: "gpt-5",300 model: "gpt-5.5",

295 prompt: {301 prompt: {

296 id: "pmpt_abc123",302 id: "pmpt_abc123",

297 variables: {303 variables: {


319)325)

320 326 

321response = client.responses.create(327response = client.responses.create(

322 model="gpt-5",328 model="gpt-5.5",

323 prompt={329 prompt={

324 "id": "pmpt_abc123",330 "id": "pmpt_abc123",

325 "variables": {331 "variables": {


341 -H "Authorization: Bearer $OPENAI_API_KEY" \347 -H "Authorization: Bearer $OPENAI_API_KEY" \

342 -H "Content-Type: application/json" \348 -H "Content-Type: application/json" \

343 -d '{349 -d '{

344 "model": "gpt-5",350 "model": "gpt-5.5",

345 "prompt": {351 "prompt": {

346 "id": "pmpt_abc123",352 "id": "pmpt_abc123",

347 "variables": {353 "variables": {


393const instructions = await fs.readFile("prompt.txt", "utf-8");399const instructions = await fs.readFile("prompt.txt", "utf-8");

394 400 

395const response = await client.responses.create({401const response = await client.responses.create({

396 model: "gpt-5",402 model: "gpt-5.5",

397 instructions,403 instructions,

398 input: "How would I declare a variable for a last name?",404 input: "How would I declare a variable for a last name?",

399});405});


409 instructions = f.read()415 instructions = f.read()

410 416 

411response = client.responses.create(417response = client.responses.create(

412 model="gpt-5",418 model="gpt-5.5",

413 instructions=instructions,419 instructions=instructions,

414 input="How would I declare a variable for a last name?",420 input="How would I declare a variable for a last name?",

415)421)


422 -H "Authorization: Bearer $OPENAI_API_KEY" \\428 -H "Authorization: Bearer $OPENAI_API_KEY" \\

423 -H "Content-Type: application/json" \\429 -H "Content-Type: application/json" \\

424 -d '{430 -d '{

425 "model": "gpt-5",431 "model": "gpt-5.5",

426 "instructions": "'"$(< prompt.txt)"'",432 "instructions": "'"$(< prompt.txt)"'",

427 "input": "How would I declare a variable for a last name?"433 "input": "How would I declare a variable for a last name?"

428 }'434 }'

Details

222 222 

223### Meta-schemas223### Meta-schemas

224 224 

225Each meta-schema has a corresponding prompt which includes few-shot examples. When combined with the reliability of Structured Outputs — even without strict mode — we were able to use `gpt-4o-mini` for schema generation.225Each meta-schema has a corresponding prompt which includes few-shot examples. When combined with the reliability of Structured Outputs — even without strict mode — we were able to generate schemas.

226 226 

227export const soMetaSchema = {227export const soMetaSchema = {

228 python:`228 python:`


240 240 

241def generate_schema(description: str):241def generate_schema(description: str):

242completion = client.chat.completions.create(242completion = client.chat.completions.create(

243model="gpt-4o-mini",243model="gpt-5.4-mini",

244response_format={"type": "json_schema", "json_schema": META_SCHEMA},244response_format={"type": "json_schema", "json_schema": META_SCHEMA},

245messages=[245messages=[

246{246{


275 275 

276def generate_function_schema(description: str):276def generate_function_schema(description: str):

277completion = client.chat.completions.create(277completion = client.chat.completions.create(

278model="gpt-4o-mini",278model="gpt-5.4-mini",

279response_format={"type": "json_schema", "json_schema": META_SCHEMA},279response_format={"type": "json_schema", "json_schema": META_SCHEMA},

280messages=[280messages=[

281{281{

Details

2 2 

3The [prompt optimizer](https://platform.openai.com/chat/edit?optimize=true) is a chat interface in the dashboard, where you enter a prompt, and we optimize it according to current best practices before returning it to you. Pairing the prompt optimizer with [datasets](https://developers.openai.com/api/docs/guides/evaluation-getting-started) is a powerful way to automatically improve prompts.3The [prompt optimizer](https://platform.openai.com/chat/edit?optimize=true) is a chat interface in the dashboard, where you enter a prompt, and we optimize it according to current best practices before returning it to you. Pairing the prompt optimizer with [datasets](https://developers.openai.com/api/docs/guides/evaluation-getting-started) is a powerful way to automatically improve prompts.

4 4 

5OpenAI is deprecating the dataset-backed prompt optimizer as part of the Evals

6 platform. Evals will become read-only for existing users on October 31, 2026,

7 and the platform is scheduled to shut down on November 30, 2026. See the

8 [deprecations page](https://developers.openai.com/api/docs/deprecations#2026-06-03-evals-platform) for the

9 current timeline.

10 

5## Prepare your data11## Prepare your data

6 12 

71. Set up a [dataset](https://developers.openai.com/api/docs/guides/evaluation-getting-started) containing the prompt you want to optimize and an evaluation dataset.131. Set up a [dataset](https://developers.openai.com/api/docs/guides/evaluation-getting-started) containing the prompt you want to optimize and an evaluation dataset.

Details

6 6 

7Prompting is both an art and a science. OpenAI has some strategies and API design decisions to help you construct strong prompts and get consistently good results from a model. We encourage you to experiment.7Prompting is both an art and a science. OpenAI has some strategies and API design decisions to help you construct strong prompts and get consistently good results from a model. We encourage you to experiment.

8 8 

9### Prompts in the API9## Prompting tools and techniques

10 10 

11OpenAI provides a long-lived prompt object, with versioning and templating shared by all users in a project. This design lets you manage, test, and reuse prompts across your team, with one central definition across APIs, SDKs, and dashboard.11- **[Prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching)**: Reduce latency by up to 80% and cost by up to 75%

12- **[Prompt engineering](https://developers.openai.com/api/docs/guides/prompt-engineering)**: Learn strategies, techniques, and tools to construct prompts

12 13 

13Universal prompt IDs give you flexibility to test and build. Variables and prompts share a base prompt, so when you create a new version, you can use that for [evals](https://developers.openai.com/api/docs/guides/evals) and determine whether a prompt performs better or worse.14## Refine your prompt

14 15 

15### Prompting tools and techniques16- Put overall tone or role guidance in the system message; keep task-specific details and examples in user messages.

17- Combine few-shot examples into a concise YAML-style or bulleted block so they’re easy to scan and update.

18- Mirror your project structure with clear folder names so teammates can locate prompts quickly.

19- Rerun your linked eval every time you publish—catching issues early is cheaper than fixing them in production.

16 20 

17- **[Prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching)**: Reduce latency by up to 80% and cost by up to 75%21## Prompts in the API

18- **[Prompt engineering](https://developers.openai.com/api/docs/guides/prompt-engineering)**: Learn strategies, techniques, and tools to construct prompts

19 22 

20## Create a prompt23OpenAI provides a long-lived prompt object, with versioning and templating shared by all users in a project. This design lets you manage, test, and reuse prompts across your team, with one central definition across APIs, SDKs, and dashboard.

24 

25OpenAI is deprecating reusable prompt objects in the API. Prompt creation will

26 be de-emphasized beginning June 3, 2026, and `v1/prompts` is scheduled to shut

27 down on November 30, 2026. See the [deprecations

28 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-reusable-prompts) for the current

29 timeline.

30 

31Universal prompt IDs give you flexibility to test and build. Variables and prompts share a base prompt, so when you create a new version, you can use that for [evals](https://developers.openai.com/api/docs/guides/evals) and determine whether a prompt performs better or worse.

32 

33### Create a prompt

21 34 

22Log in and use the OpenAI [dashboard](https://platform.openai.com/chat) to create, save, version, and share your prompts.35Log in and use the OpenAI [dashboard](https://platform.openai.com/chat) to create, save, version, and share your prompts.

23 36 


64 77 

65 In the [prompts dashboard](https://platform.openai.com/chat), select the prompt you want to roll back. On the right, click **History**. Find the version you want to restore, and click **Restore**.78 In the [prompts dashboard](https://platform.openai.com/chat), select the prompt you want to roll back. On the right, click **History**. Find the version you want to restore, and click **Restore**.

66 79 

67## Refine your prompt

68 

69- Put overall tone or role guidance in the system message; keep task-specific details and examples in user messages.

70- Combine few-shot examples into a concise YAML-style or bulleted block so they’re easy to scan and update.

71- Mirror your project structure with clear folder names so teammates can locate prompts quickly.

72- Rerun your linked eval every time you publish—catching issues early is cheaper than fixing them in production.

73 

74## Next steps80## Next steps

75 81 

76When you feel confident in your prompts, you might want to check out the following guides and resources.82When you feel confident in your prompts, you might want to check out the following guides and resources.

77 83 

78[84[

79 85 

80<span slot="icon">

81 </span>

82 Use the Playground to develop and iterate on prompts.

83 

84](https://platform.openai.com/chat/edit)

85 

86[

87 

88<span slot="icon">86<span slot="icon">

89 </span>87 </span>

90 Learn how to prompt a model to generate text.88 Learn how to prompt a model to generate text.

Details

1# Migrate from prompt objects1# Migrate from prompt objects

2 2 

3OpenAI is deprecating reusable prompt objects in the API. Prompt creation will

4 be de-emphasized beginning June 3, 2026, and `v1/prompts` is scheduled to shut

5 down on November 30, 2026. See the [deprecations

6 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-reusable-prompts) for the current

7 timeline.

8 

3To migrate away from **Prompts** in the OpenAI API platform, move the prompt content out of the managed `prompt` object and into your application code. This gives you more control over review, testing, deployment, and versioning.9To migrate away from **Prompts** in the OpenAI API platform, move the prompt content out of the managed `prompt` object and into your application code. This gives you more control over review, testing, deployment, and versioning.

4 10 

5## Before: using a Prompt Object11## Before: using a Prompt Object


76 },82 },

77 {83 {

78 role: "user",84 role: "user",

79 content: \`85 content:

80Customer name: Acme86 "Customer name: Acme. Issue: billing question. Write a response to the customer.",

81Issue: billing question

82 

83Write a response to the customer.

84 \`.trim(),

85 },87 },

86 ],88 ],

87});89});


103 },105 },

104 {106 {

105 "role": "user",107 "role": "user",

106 "content": """108 "content": "Customer name: Acme. Issue: billing question. Write a response to the customer.",

107Customer name: Acme

108Issue: billing question

109 

110Write a response to the customer.

111 """.strip(),

112 },109 },

113 ],110 ],

114)111)


129 },126 },

130 {127 {

131 "role": "user",128 "role": "user",

132 "content": "Customer name: Acme\\nIssue: billing question\\n\\nWrite a response to the customer."129 "content": "Customer name: Acme. Issue: billing question. Write a response to the customer."

133 }130 }

134 ]131 ]

135 }'132 }'


167 return [164 return [

168 {165 {

169 role: "system",166 role: "system",

170 content: \`167 content:

171You are a helpful support assistant.168 "You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.",

172Be concise, accurate, and friendly.

173Do not invent policy details.

174 \`.trim(),

175 },169 },

176 {170 {

177 role: "user",171 role: "user",

178 content: \`172 content: \`Customer name: \${customerName}. Issue: \${issue}. Write a response to the customer.\`,

179Customer name: \${customerName}

180Issue: \${issue}

181 

182Write a response to the customer.

183 \`.trim(),

184 },173 },

185 ];174 ];

186}175}


203 return [192 return [

204 {193 {

205 "role": "system",194 "role": "system",

206 "content": """195 "content": "You are a helpful support assistant. Be concise, accurate, and friendly. Do not invent policy details.",

207You are a helpful support assistant.

208Be concise, accurate, and friendly.

209Do not invent policy details.

210 """.strip(),

211 },196 },

212 {197 {

213 "role": "user",198 "role": "user",

214 "content": f"""199 "content": f"Customer name: {customer_name}. Issue: {issue}. Write a response to the customer.",

215Customer name: {customer_name}

216Issue: {issue}

217 

218Write a response to the customer.

219 """.strip(),

220 },200 },

221 ]201 ]

222 202 

Details

15def completion_with_backoff(**kwargs):15def completion_with_backoff(**kwargs):

16return client.completions.create(**kwargs)16return client.completions.create(**kwargs)

17 17 

18completion_with_backoff(model="gpt-4o-mini", prompt="Once upon a time,")18completion_with_backoff(model="gpt-3.5-turbo-instruct", prompt="Once upon a time,")

19`.trim(),19`.trim(),

20};20};

21 21 


30def completions_with_backoff(**kwargs):30def completions_with_backoff(**kwargs):

31return client.completions.create(**kwargs)31return client.completions.create(**kwargs)

32 32 

33completions_with_backoff(model="gpt-4o-mini", prompt="Once upon a time,")33completions_with_backoff(model="gpt-3.5-turbo-instruct", prompt="Once upon a time,")

34`.trim(),34`.trim(),

35};35};

36 36 


121 121 

122- Rate limits are defined at the [organization level](https://developers.openai.com/api/docs/guides/production-best-practices) and at the project level, not user level.122- Rate limits are defined at the [organization level](https://developers.openai.com/api/docs/guides/production-best-practices) and at the project level, not user level.

123- Rate limits vary by the [model](https://developers.openai.com/api/docs/models) being used.123- Rate limits vary by the [model](https://developers.openai.com/api/docs/models) being used.

124- For long context models like GPT-4.1, there is a separate rate limit for long context requests. You can view these rate limits in [developer console](https://platform.openai.com/settings/organization/limits).124- For long context models like GPT-5.5, there is a separate rate limit for long context requests. You can view these rate limits in [developer console](https://platform.openai.com/settings/organization/limits).

125- Limits are also placed on the total amount an organization can spend on the API each month. These are also known as "usage limits".125- Limits are also placed on the total amount an organization can spend on the API each month. These are also known as "usage limits".

126- Some model families have shared rate limits. Any models listed under a "shared limit" in your [organizations limit page](https://platform.openai.com/settings/organization/limits) share a rate limit between them. For example, if the listed shared TPM is 3.5M, all calls to any model in the given "shared limit" list will count towards that 3.5M.126- Some model families have shared rate limits. Any models listed under a "shared limit" in your [organizations limit page](https://platform.openai.com/settings/organization/limits) share a rate limit between them. For example, if the listed shared TPM is 3.5M, all calls to any model in the given "shared limit" list will count towards that 3.5M.

127- Vector store ingestion is also rate limited per vector store ID. `/vector_stores/{vector_store_id}/files` and `/vector_stores/{vector_store_id}/file_batches` share a limit of 300 requests per minute for each vector store. For larger ingests, prefer `/vector_stores/{vector_store_id}/file_batches`.127- Vector store ingestion is also rate limited per vector store ID. `/vector_stores/{vector_store_id}/files` and `/vector_stores/{vector_store_id}/file_batches` share a limit of 300 requests per minute for each vector store. For larger ingests, prefer `/vector_stores/{vector_store_id}/file_batches`.

Details

6client = OpenAI()6client = OpenAI()

7 7 

8response = client.chat.completions.create(8response = client.chat.completions.create(

9model="gpt-4o-mini",9model="gpt-5.5",

10messages=[10messages=[

11{"role": "user", "content": "This is a test"}11{"role": "user", "content": "This is a test"}

12],12],

13max_tokens=5,13max_completion_tokens=5,

14safety_identifier="user_123456"14safety_identifier="user_123456"

15)15)

16`.trim(),16`.trim(),


19-H "Content-Type: application/json" \\19-H "Content-Type: application/json" \\

20-H "Authorization: Bearer $OPENAI_API_KEY" \\20-H "Authorization: Bearer $OPENAI_API_KEY" \\

21-d '{21-d '{

22"model": "gpt-4o-mini",22"model": "gpt-5.5",

23"messages": [23"messages": [

24{"role": "user", "content": "This is a test"}24{"role": "user", "content": "This is a test"}

25],25],

26"max_tokens": 5,26"max_completion_tokens": 5,

27"safety_identifier": "user123456"27"safety_identifier": "user123456"

28}'28}'

29`.trim(),29`.trim(),

Details

154|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|154|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|

155| **Outputs valid JSON** | Yes | Yes |155| **Outputs valid JSON** | Yes | Yes |

156| **Adheres to schema** | Yes (see [supported schemas](#supported-schemas)) | No |156| **Adheres to schema** | Yes (see [supported schemas](#supported-schemas)) | No |

157| **Compatible models** | `gpt-4o-mini`, `gpt-4o-2024-08-06`, and later | `gpt-3.5-turbo`, `gpt-4-*` and `gpt-4o-*` models |157| **Compatible models** | `gpt-4o-mini`, `gpt-4o-2024-08-06`, and later | `gpt-3.5-turbo`, `gpt-4-*`, `gpt-4o-*`, and compatible GPT-5 models |

158| **Enabling** | `text: { format: { type: "json_schema", "strict": true, "schema": ... } }` | `text: { format: { type: "json_object" } }` |158| **Enabling** | `text: { format: { type: "json_schema", "strict": true, "schema": ... } }` | `text: { format: { type: "json_object" } }` |

159 159 

160 160 

guides/text.md +20 −14

Details

37 37 

38Some prompt engineering techniques work with every model, like using message roles. But different models might need to be prompted differently to produce the best results. Even different snapshots of models within the same family could produce different results. So as you build more complex applications, we strongly recommend:38Some prompt engineering techniques work with every model, like using message roles. But different models might need to be prompted differently to produce the best results. Even different snapshots of models within the same family could produce different results. So as you build more complex applications, we strongly recommend:

39 39 

40- Pinning your production applications to specific [model snapshots](https://developers.openai.com/api/docs/models) (like `gpt-5-2025-08-07` for example) to ensure consistent behavior40- Pinning your production applications to specific [model snapshots](https://developers.openai.com/api/docs/models) (like `gpt-5.5-2026-04-23` for example) to ensure consistent behavior

41- Building [evals](https://developers.openai.com/api/docs/guides/evals) that measure the behavior of your prompts so you can monitor prompt performance as you iterate, or when you change and upgrade model versions41- Building [evals](https://developers.openai.com/api/docs/guides/evals) that measure the behavior of your prompts so you can monitor prompt performance as you iterate, or when you change and upgrade model versions

42 42 

43Now, let's examine some tools and techniques available to you to construct prompts.43Now, let's examine some tools and techniques available to you to construct prompts.

44 44 

45## Choosing models and APIs45## Choosing models and APIs

46 46 

47OpenAI has many different [models](https://developers.openai.com/api/docs/models) and several APIs to choose from. [Reasoning models](https://developers.openai.com/api/docs/guides/reasoning), like o3 and GPT-5, behave differently from chat models and respond better to different prompts. One important note is that reasoning models perform better and demonstrate higher intelligence when used with the Responses API.47OpenAI has many different [models](https://developers.openai.com/api/docs/models) and several APIs to choose from. [Reasoning models](https://developers.openai.com/api/docs/guides/reasoning), like [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5), behave differently from chat models and respond better to different prompts. One important note is that reasoning models perform better and demonstrate higher intelligence when used with the Responses API.

48 48 

49If you're building any text generation app, we recommend using the Responses API over the older Chat Completions API. And if you're using a reasoning model, it's especially useful to [migrate to Responses](https://developers.openai.com/api/docs/guides/migrate-to-responses).49If you're building any text generation app, we recommend using the Responses API over the older Chat Completions API. And if you're using a reasoning model, it's especially useful to [migrate to Responses](https://developers.openai.com/api/docs/guides/migrate-to-responses).

50 50 


61const client = new OpenAI();61const client = new OpenAI();

62 62 

63const response = await client.responses.create({63const response = await client.responses.create({

64 model: "gpt-5",64 model: "gpt-5.5",

65 reasoning: { effort: "low" },65 reasoning: { effort: "low" },

66 instructions: "${semicolonsDevMsg}",66 instructions: "${semicolonsDevMsg}",

67 input: "${semicolonsPrompt}",67 input: "${semicolonsPrompt}",


75client = OpenAI()75client = OpenAI()

76 76 

77response = client.responses.create(77response = client.responses.create(

78 model="gpt-5",78 model="gpt-5.5",

79 reasoning={"effort": "low"},79 reasoning={"effort": "low"},

80 instructions="${semicolonsDevMsg}",80 instructions="${semicolonsDevMsg}",

81 input="${semicolonsPrompt}",81 input="${semicolonsPrompt}",


89 -H "Content-Type: application/json" \\89 -H "Content-Type: application/json" \\

90 -H "Authorization: Bearer $OPENAI_API_KEY" \\90 -H "Authorization: Bearer $OPENAI_API_KEY" \\

91 -d '{91 -d '{

92 "model": "gpt-5",92 "model": "gpt-5.5",

93 "reasoning": {"effort": "low"},93 "reasoning": {"effort": "low"},

94 "instructions": "${semicolonsDevMsg}",94 "instructions": "${semicolonsDevMsg}",

95 "input": "${semicolonsPrompt}"95 "input": "${semicolonsPrompt}"


106const client = new OpenAI();106const client = new OpenAI();

107 107 

108const response = await client.responses.create({108const response = await client.responses.create({

109 model: "gpt-5",109 model: "gpt-5.5",

110 reasoning: { effort: "low" },110 reasoning: { effort: "low" },

111 input: [111 input: [

112 {112 {


128client = OpenAI()128client = OpenAI()

129 129 

130response = client.responses.create(130response = client.responses.create(

131 model="gpt-5",131 model="gpt-5.5",

132 reasoning={"effort": "low"},132 reasoning={"effort": "low"},

133 input=[133 input=[

134 {134 {


150 -H "Content-Type: application/json" \\150 -H "Content-Type: application/json" \\

151 -H "Authorization: Bearer $OPENAI_API_KEY" \\151 -H "Authorization: Bearer $OPENAI_API_KEY" \\

152 -d '{152 -d '{

153 "model": "gpt-5",153 "model": "gpt-5.5",

154 "reasoning": {"effort": "low"},154 "reasoning": {"effort": "low"},

155 "input": [155 "input": [

156 {156 {


206 206 

207In the OpenAI dashboard, you can develop reusable [prompts](https://platform.openai.com/chat/edit) that you can use in API requests, rather than specifying the content of prompts in code. This way, you can more easily build and evaluate your prompts, and deploy improved versions of your prompts without changing your integration code.207In the OpenAI dashboard, you can develop reusable [prompts](https://platform.openai.com/chat/edit) that you can use in API requests, rather than specifying the content of prompts in code. This way, you can more easily build and evaluate your prompts, and deploy improved versions of your prompts without changing your integration code.

208 208 

209OpenAI is deprecating reusable prompt objects in the API. Prompt creation will

210 be de-emphasized beginning June 3, 2026, and `v1/prompts` is scheduled to shut

211 down on November 30, 2026. See the [deprecations

212 page](https://developers.openai.com/api/docs/deprecations#2026-06-03-reusable-prompts) for the current

213 timeline.

214 

209Here's how it works:215Here's how it works:

210 216 

2111. **Create a reusable prompt** in the [dashboard](https://platform.openai.com/chat/edit) with placeholders like `{{customer_name}}`.2171. **Create a reusable prompt** in the [dashboard](https://platform.openai.com/chat/edit) with placeholders like `{{customer_name}}`.


225const client = new OpenAI();231const client = new OpenAI();

226 232 

227const response = await client.responses.create({233const response = await client.responses.create({

228 model: "gpt-5",234 model: "gpt-5.5",

229 prompt: {235 prompt: {

230 id: "pmpt_abc123",236 id: "pmpt_abc123",

231 version: "2",237 version: "2",


244client = OpenAI()250client = OpenAI()

245 251 

246response = client.responses.create(252response = client.responses.create(

247 model="gpt-5",253 model="gpt-5.5",

248 prompt={254 prompt={

249 "id": "pmpt_abc123",255 "id": "pmpt_abc123",

250 "version": "2",256 "version": "2",


263 -H "Authorization: Bearer $OPENAI_API_KEY" \\269 -H "Authorization: Bearer $OPENAI_API_KEY" \\

264 -H "Content-Type: application/json" \\270 -H "Content-Type: application/json" \\

265 -d '{271 -d '{

266 "model": "gpt-5",272 "model": "gpt-5.5",

267 "prompt": {273 "prompt": {

268 "id": "pmpt_abc123",274 "id": "pmpt_abc123",

269 "version": "2",275 "version": "2",


292});298});

293 299 

294const response = await client.responses.create({300const response = await client.responses.create({

295 model: "gpt-5",301 model: "gpt-5.5",

296 prompt: {302 prompt: {

297 id: "pmpt_abc123",303 id: "pmpt_abc123",

298 variables: {304 variables: {


320)326)

321 327 

322response = client.responses.create(328response = client.responses.create(

323 model="gpt-5",329 model="gpt-5.5",

324 prompt={330 prompt={

325 "id": "pmpt_abc123",331 "id": "pmpt_abc123",

326 "variables": {332 "variables": {


342 -H "Authorization: Bearer $OPENAI_API_KEY" \348 -H "Authorization: Bearer $OPENAI_API_KEY" \

343 -H "Content-Type: application/json" \349 -H "Content-Type: application/json" \

344 -d '{350 -d '{

345 "model": "gpt-5",351 "model": "gpt-5.5",

346 "prompt": {352 "prompt": {

347 "id": "pmpt_abc123",353 "id": "pmpt_abc123",

348 "variables": {354 "variables": {

Details

24 -H "Content-Type: application/json" \\24 -H "Content-Type: application/json" \\

25 -H "Authorization: Bearer $OPENAI_API_KEY" \\25 -H "Authorization: Bearer $OPENAI_API_KEY" \\

26 -d '{26 -d '{

27 "model": "gpt-4.1",27 "model": "gpt-5.5",

28 "tools": [{28 "tools": [{

29 "type": "code_interpreter",29 "type": "code_interpreter",

30 "container": { "type": "auto", "memory_limit": "4g" }30 "container": { "type": "auto", "memory_limit": "4g" }


44\`;44\`;

45 45 

46const resp = await client.responses.create({46const resp = await client.responses.create({

47 model: "gpt-4.1",47 model: "gpt-5.5",

48 tools: [48 tools: [

49 {49 {

50 type: "code_interpreter",50 type: "code_interpreter",


69"""69"""

70 70 

71resp = client.responses.create(71resp = client.responses.create(

72 model="gpt-4.1",72 model="gpt-5.5",

73 tools=[73 tools=[

74 {74 {

75 "type": "code_interpreter",75 "type": "code_interpreter",


114 -H "Authorization: Bearer $OPENAI_API_KEY" \\114 -H "Authorization: Bearer $OPENAI_API_KEY" \\

115 -H "Content-Type: application/json" \\115 -H "Content-Type: application/json" \\

116 -d '{116 -d '{

117 "model": "gpt-4.1",117 "model": "gpt-5.5",

118 "tools": [{118 "tools": [{

119 "type": "code_interpreter",119 "type": "code_interpreter",

120 "container": "cntr_abc123"120 "container": "cntr_abc123"


131container = client.containers.create(name="test-container", memory_limit="4g")131container = client.containers.create(name="test-container", memory_limit="4g")

132 132 

133response = client.responses.create(133response = client.responses.create(

134 model="gpt-4.1",134 model="gpt-5.5",

135 tools=[{135 tools=[{

136 "type": "code_interpreter",136 "type": "code_interpreter",

137 "container": container.id137 "container": container.id


150const container = await client.containers.create({ name: "test-container", memory_limit: "4g" });150const container = await client.containers.create({ name: "test-container", memory_limit: "4g" });

151 151 

152const resp = await client.responses.create({152const resp = await client.responses.create({

153 model: "gpt-4.1",153 model: "gpt-5.5",

154 tools: [154 tools: [

155 {155 {

156 type: "code_interpreter",156 type: "code_interpreter",

Details

142-H "Content-Type: application/json" \\142-H "Content-Type: application/json" \\

143-H "Authorization: Bearer $OPENAI_API_KEY" \\143-H "Authorization: Bearer $OPENAI_API_KEY" \\

144-d '{144-d '{

145 "model": "gpt-5",145 "model": "gpt-5.5",

146 "tools": [146 "tools": [

147 {147 {

148 "type": "mcp",148 "type": "mcp",


161const client = new OpenAI();161const client = new OpenAI();

162 162 

163const resp = await client.responses.create({163const resp = await client.responses.create({

164 model: "gpt-5",164 model: "gpt-5.5",

165 tools: [165 tools: [

166 {166 {

167 type: "mcp",167 type: "mcp",


183client = OpenAI()183client = OpenAI()

184 184 

185resp = client.responses.create(185resp = client.responses.create(

186 model="gpt-5",186 model="gpt-5.5",

187 tools=[187 tools=[

188 {188 {

189 "type": "mcp",189 "type": "mcp",


204 204 

205string dropboxToken = Environment.GetEnvironmentVariable("DROPBOX_OAUTH_ACCESS_TOKEN")!;205string dropboxToken = Environment.GetEnvironmentVariable("DROPBOX_OAUTH_ACCESS_TOKEN")!;

206string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;206string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

207OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);207OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

208 208 

209ResponseCreationOptions options = new();209ResponseCreationOptions options = new();

210options.Tools.Add(ResponseTool.CreateMcpTool(210options.Tools.Add(ResponseTool.CreateMcpTool(


328-H "Content-Type: application/json" \\328-H "Content-Type: application/json" \\

329-H "Authorization: Bearer $OPENAI_API_KEY" \\329-H "Authorization: Bearer $OPENAI_API_KEY" \\

330-d '{330-d '{

331 "model": "gpt-5",331 "model": "gpt-5.5",

332 "tools": [332 "tools": [

333 {333 {

334 "type": "mcp",334 "type": "mcp",


348const client = new OpenAI();348const client = new OpenAI();

349 349 

350const resp = await client.responses.create({350const resp = await client.responses.create({

351 model: "gpt-5",351 model: "gpt-5.5",

352 tools: [{352 tools: [{

353 type: "mcp",353 type: "mcp",

354 server_label: "dmcp",354 server_label: "dmcp",


369client = OpenAI()369client = OpenAI()

370 370 

371resp = client.responses.create(371resp = client.responses.create(

372 model="gpt-5",372 model="gpt-5.5",

373 tools=[{373 tools=[{

374 "type": "mcp",374 "type": "mcp",

375 "server_label": "dmcp",375 "server_label": "dmcp",


388using OpenAI.Responses;388using OpenAI.Responses;

389 389 

390string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;390string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

391OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);391OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

392 392 

393ResponseCreationOptions options = new();393ResponseCreationOptions options = new();

394options.Tools.Add(ResponseTool.CreateMcpTool(394options.Tools.Add(ResponseTool.CreateMcpTool(


452-H "Content-Type: application/json" \\452-H "Content-Type: application/json" \\

453-H "Authorization: Bearer $OPENAI_API_KEY" \\453-H "Authorization: Bearer $OPENAI_API_KEY" \\

454-d '{454-d '{

455 "model": "gpt-5",455 "model": "gpt-5.5",

456 "tools": [456 "tools": [

457 {457 {

458 "type": "mcp",458 "type": "mcp",


476const client = new OpenAI();476const client = new OpenAI();

477 477 

478const resp = await client.responses.create({478const resp = await client.responses.create({

479 model: "gpt-5",479 model: "gpt-5.5",

480 tools: [{480 tools: [{

481 type: "mcp",481 type: "mcp",

482 server_label: "dmcp",482 server_label: "dmcp",


501client = OpenAI()501client = OpenAI()

502 502 

503resp = client.responses.create(503resp = client.responses.create(

504 model="gpt-5",504 model="gpt-5.5",

505 tools=[{505 tools=[{

506 "type": "mcp",506 "type": "mcp",

507 "server_label": "dmcp",507 "server_label": "dmcp",


524using OpenAI.Responses;524using OpenAI.Responses;

525 525 

526string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;526string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

527OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);527OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

528 528 

529ResponseCreationOptions options = new();529ResponseCreationOptions options = new();

530options.Tools.Add(ResponseTool.CreateMcpTool(530options.Tools.Add(ResponseTool.CreateMcpTool(


563-H "Content-Type: application/json" \\563-H "Content-Type: application/json" \\

564-H "Authorization: Bearer $OPENAI_API_KEY" \\564-H "Authorization: Bearer $OPENAI_API_KEY" \\

565-d '{565-d '{

566 "model": "gpt-5",566 "model": "gpt-5.5",

567 "tools": [567 "tools": [

568 {568 {

569 "type": "mcp",569 "type": "mcp",


585const client = new OpenAI();585const client = new OpenAI();

586 586 

587const resp = await client.responses.create({587const resp = await client.responses.create({

588 model: "gpt-5",588 model: "gpt-5.5",

589 tools: [589 tools: [

590 {590 {

591 type: "mcp",591 type: "mcp",


610client = OpenAI()610client = OpenAI()

611 611 

612resp = client.responses.create(612resp = client.responses.create(

613 model="gpt-5",613 model="gpt-5.5",

614 tools=[614 tools=[

615 {615 {

616 "type": "mcp",616 "type": "mcp",


633using OpenAI.Responses;633using OpenAI.Responses;

634 634 

635string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;635string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

636OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);636OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

637 637 

638ResponseCreationOptions options = new();638ResponseCreationOptions options = new();

639options.Tools.Add(ResponseTool.CreateMcpTool(639options.Tools.Add(ResponseTool.CreateMcpTool(


664-H "Content-Type: application/json" \\664-H "Content-Type: application/json" \\

665-H "Authorization: Bearer $OPENAI_API_KEY" \\665-H "Authorization: Bearer $OPENAI_API_KEY" \\

666-d '{666-d '{

667 "model": "gpt-5",667 "model": "gpt-5.5",

668 "input": "Create a payment link for $20",668 "input": "Create a payment link for $20",

669 "tools": [669 "tools": [

670 {670 {


682const client = new OpenAI();682const client = new OpenAI();

683 683 

684const resp = await client.responses.create({684const resp = await client.responses.create({

685 model: "gpt-5",685 model: "gpt-5.5",

686 input: "Create a payment link for $20",686 input: "Create a payment link for $20",

687 tools: [687 tools: [

688 {688 {


703client = OpenAI()703client = OpenAI()

704 704 

705resp = client.responses.create(705resp = client.responses.create(

706 model="gpt-5",706 model="gpt-5.5",

707 input="Create a payment link for $20",707 input="Create a payment link for $20",

708 tools=[708 tools=[

709 {709 {


723 723 

724string authToken = Environment.GetEnvironmentVariable("STRIPE_OAUTH_ACCESS_TOKEN")!;724string authToken = Environment.GetEnvironmentVariable("STRIPE_OAUTH_ACCESS_TOKEN")!;

725string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;725string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

726OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);726OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

727 727 

728ResponseCreationOptions options = new();728ResponseCreationOptions options = new();

729options.Tools.Add(ResponseTool.CreateMcpTool(729options.Tools.Add(ResponseTool.CreateMcpTool(


786 -H "Content-Type: application/json" \\786 -H "Content-Type: application/json" \\

787 -H "Authorization: Bearer $OPENAI_API_KEY" \\787 -H "Authorization: Bearer $OPENAI_API_KEY" \\

788 -d '{788 -d '{

789 "model": "gpt-5",789 "model": "gpt-5.5",

790 "tools": [790 "tools": [

791 {791 {

792 "type": "mcp",792 "type": "mcp",


805const client = new OpenAI();805const client = new OpenAI();

806 806 

807const resp = await client.responses.create({807const resp = await client.responses.create({

808 model: "gpt-5",808 model: "gpt-5.5",

809 tools: [809 tools: [

810 {810 {

811 type: "mcp",811 type: "mcp",


827client = OpenAI()827client = OpenAI()

828 828 

829resp = client.responses.create(829resp = client.responses.create(

830 model="gpt-5",830 model="gpt-5.5",

831 tools=[831 tools=[

832 {832 {

833 "type": "mcp",833 "type": "mcp",


848 848 

849string authToken = Environment.GetEnvironmentVariable("GOOGLE_CALENDAR_OAUTH_ACCESS_TOKEN")!;849string authToken = Environment.GetEnvironmentVariable("GOOGLE_CALENDAR_OAUTH_ACCESS_TOKEN")!;

850string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;850string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

851OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);851OpenAIResponseClient client = new(model: "gpt-5.5", apiKey: key);

852 852 

853ResponseCreationOptions options = new();853ResponseCreationOptions options = new();

854options.Tools.Add(ResponseTool.CreateMcpTool(854options.Tools.Add(ResponseTool.CreateMcpTool(

Details

1# Meeting minutes1# Meeting minutes

2 2 

3In this tutorial, we'll harness the power of OpenAI's Whisper and GPT-4 models to develop an automated meeting minutes generator. The application transcribes audio from a meeting, provides a summary of the discussion, extracts key points and action items, and performs a sentiment analysis.3In this tutorial, we'll harness the power of OpenAI's Whisper and GPT models to develop an automated meeting minutes generator. The application transcribes audio from a meeting, provides a summary of the discussion, extracts key points and action items, and performs a sentiment analysis.

4 4 

5## Getting started5## Getting started

6 6 


71 71 

72In this function, `audio_file_path` is the path to the audio file you want to transcribe. The function opens this file and passes it to the Whisper ASR model (`whisper-1`) for transcription. The result is returned as raw text. It’s important to note that the `openai.Audio.transcribe` function requires the actual audio file to be passed in, not just the path to the file locally or on a remote server. This means that if you are running this code on a server where you might not also be storing your audio files, you will need to have a preprocessing step that first downloads the audio files onto that device.72In this function, `audio_file_path` is the path to the audio file you want to transcribe. The function opens this file and passes it to the Whisper ASR model (`whisper-1`) for transcription. The result is returned as raw text. It’s important to note that the `openai.Audio.transcribe` function requires the actual audio file to be passed in, not just the path to the file locally or on a remote server. This means that if you are running this code on a server where you might not also be storing your audio files, you will need to have a preprocessing step that first downloads the audio files onto that device.

73 73 

74## Summarizing and analyzing the transcript with GPT-474## Summarizing and analyzing the transcript with a GPT model

75 75 

76Having obtained the transcript, we now pass it to GPT-4 via the [Chat Completions API](https://developers.openai.com/api/docs/api-reference/chat/create). GPT-4 is OpenAI's state-of-the-art large language model which we'll use to generate a summary, extract key points, action items, and perform sentiment analysis.76Having obtained the transcript, we now pass it to a GPT model via the [Chat Completions API](https://developers.openai.com/api/docs/api-reference/chat/create). The snippets below use a tested model to generate a summary, extract key points, action items, and perform sentiment analysis. For new projects, start with [`gpt-5.5`](https://developers.openai.com/api/docs/models/gpt-5.5).

77 77 

78This tutorial uses distinct functions for each task we want GPT-4 to perform. This is not the most efficient way to do this task - you can put these instructions into one function, however, splitting them up can lead to higher quality summarization.78This tutorial uses distinct functions for each task we want the model to perform. This is not the most efficient way to do this task - you can put these instructions into one function, however, splitting them up can lead to higher quality summarization.

79 79 

80To split the tasks up, we define the `meeting_minutes` function which will serve as the main function of this application:80To split the tasks up, we define the `meeting_minutes` function which will serve as the main function of this application:

81 81 


104```python104```python

105def abstract_summary_extraction(transcription):105def abstract_summary_extraction(transcription):

106 response = client.chat.completions.create(106 response = client.chat.completions.create(

107 model="gpt-4",107 model="gpt-5.5",

108 temperature=0,

109 messages=[108 messages=[

110 {109 {

111 "role": "system",110 "role": "system",


128 127 

129def key_points_extraction(transcription):128def key_points_extraction(transcription):

130 response = client.chat.completions.create(129 response = client.chat.completions.create(

131 model="gpt-4",130 model="gpt-5.5",

132 temperature=0,

133 messages=[131 messages=[

134 {132 {

135 "role": "system",133 "role": "system",


152 150 

153def action_item_extraction(transcription):151def action_item_extraction(transcription):

154 response = client.chat.completions.create(152 response = client.chat.completions.create(

155 model="gpt-4",153 model="gpt-5.5",

156 temperature=0,

157 messages=[154 messages=[

158 {155 {

159 "role": "system",156 "role": "system",


170 167 

171### Sentiment analysis168### Sentiment analysis

172 169 

173The `sentiment_analysis` function analyzes the overall sentiment of the discussion. It considers the tone, the emotions conveyed by the language used, and the context in which words and phrases are used. For tasks which are less complicated, it may also be worthwhile to try out `gpt-3.5-turbo` in addition to `gpt-4` to see if you can get a similar level of performance. It might also be useful to experiment with taking the results of the `sentiment_analysis` function and passing it to the other functions to see how having the sentiment of the conversation impacts the other attributes.170The `sentiment_analysis` function analyzes the overall sentiment of the discussion. It considers the tone, the emotions conveyed by the language used, and the context in which words and phrases are used. For less complicated tasks, it may also be worthwhile to try [`gpt-5.4-mini`](https://developers.openai.com/api/docs/models/gpt-5.4-mini) to see if you can get a similar level of performance at lower cost and latency. It might also be useful to experiment with taking the results of the `sentiment_analysis` function and passing it to the other functions to see how having the sentiment of the conversation impacts the other attributes.

174 171 

175```python172```python

176def sentiment_analysis(transcription):173def sentiment_analysis(transcription):

177 response = client.chat.completions.create(174 response = client.chat.completions.create(

178 model="gpt-4",175 model="gpt-5.5",

179 temperature=0,

180 messages=[176 messages=[

181 {177 {

182 "role": "system",178 "role": "system",

Details

464```python464```python

465def answer_question(465def answer_question(

466 df,466 df,

467 model="gpt-3.5-turbo",467 model="gpt-3.5-turbo-instruct",

468 question="Am I allowed to publish model outputs to Twitter, without a human review?",468 question="Am I allowed to publish model outputs to Twitter, without a human review?",

469 max_len=1800,469 max_len=1800,

470 size="ada",470 size="ada",


487 print("\n\n")487 print("\n\n")

488 488 

489 try:489 try:

490 # Create a chat completion using the question and context490 # Create a completion using the question and context

491 response = client.chat.completions.create(491 response = client.completions.create(

492 model="gpt-3.5-turbo",492 model=model,

493 messages=[493 prompt=f"Answer the question based on the context below, and if the question can't be answered based on the context, say \"I don't know\"\n\nContext: {context}\n\n---\n\nQuestion: {question}\nAnswer:",

494 {"role": "system", "content": "Answer the question based on the context below, and if the question can't be answered based on the context, say \"I don't know\"\n\n"},

495 {"role": "user", f"content": "Context: {context}\n\n---\n\nQuestion: {question}\nAnswer:"}

496 ],

497 temperature=0,494 temperature=0,

498 max_tokens=max_tokens,495 max_tokens=max_tokens,

499 top_p=1,496 top_p=1,


501 presence_penalty=0,498 presence_penalty=0,

502 stop=stop_sequence,499 stop=stop_sequence,

503 )500 )

504 return response.choices[0].message.strip()501 return response.choices[0].text.strip()

505 except Exception as e:502 except Exception as e:

506 print(e)503 print(e)

507 return ""504 return ""