Skip to content

Examples and guides for using the OpenAI API

Tighten prose in developer-linked cookbooks (#2856)

Vaibhav Srivastav20793784ac46
diff --git a/articles/chatgpt-agents-sales-meeting-prep.md b/articles/chatgpt-agents-sales-meeting-prep.md
index b32459ba..3297edb9 100644
--- a/articles/chatgpt-agents-sales-meeting-prep.md
+++ b/articles/chatgpt-agents-sales-meeting-prep.md
@@ -97,7 +97,7 @@ Skills package instructions, resources, and scripts to help our agent reliably c
<img src="https://cdn.openai.com/cookbook/chatgpt-agents-sales-meeting-prep/img5.png" alt="Creating a skill for our agent" width="336" />
</p>
-Our assistant will read the meeting template we've provided, and help us create a customized skill that matches the output format we want. In order to polish our skill, we can either click into the skill and edit it directly within the agent builder, and we can upload additional files that the agent can use when it decides to use the skill.
+Our assistant will read the meeting template and help us create a custom skill that matches the output format we want. To refine the skill, edit it directly in the agent builder or upload files it can use.
<p align="center">
<img src="https://cdn.openai.com/cookbook/chatgpt-agents-sales-meeting-prep/img6.png" alt="Editing a skill for our agent" width="60%" />
diff --git a/examples/Generate_Images_With_GPT_Image.ipynb b/examples/Generate_Images_With_GPT_Image.ipynb
index 0a227446..29a46cd8 100644
--- a/examples/Generate_Images_With_GPT_Image.ipynb
+++ b/examples/Generate_Images_With_GPT_Image.ipynb
@@ -566,7 +566,7 @@
"metadata": {},
"source": [
"#### Editing with the mask\n",
- "When using a mask, we still need the prompt the model describing the entiring resulting image, not just the area that is masked. "
+ "When using a mask, the prompt must describe the entire resulting image, not only the edited area. "
]
},
{
diff --git a/examples/How_to_handle_rate_limits.ipynb b/examples/How_to_handle_rate_limits.ipynb
index 9b65287e..dad26669 100644
--- a/examples/How_to_handle_rate_limits.ipynb
+++ b/examples/How_to_handle_rate_limits.ipynb
@@ -498,9 +498,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "OpenAI's [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) feature offers a robust way to batch multiple prompts in a single request. \n",
+ "OpenAI's [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) feature lets you batch multiple prompts in one request. \n",
"\n",
- "Here, rather than parsing raw text or hoping the model follows informal formatting, you specify a strict schema. This ensures your application can reliably parse the results by examining the defined structure. This eliminates the need for extensive validation or complicated parsing logic, as Structured Outputs guarantees consistent, type-safe data."
+ "Rather than parsing raw text or relying on informal formatting, specify a strict schema. Structured Outputs enforces that structure, which reduces parsing and structural validation. Application code must still validate business rules and the meaning of each value."
]
},
{
diff --git a/examples/Leveraging_model_distillation_to_fine-tune_a_model.ipynb b/examples/Leveraging_model_distillation_to_fine-tune_a_model.ipynb
index e64fba5c..86f604cc 100644
--- a/examples/Leveraging_model_distillation_to_fine-tune_a_model.ipynb
+++ b/examples/Leveraging_model_distillation_to_fine-tune_a_model.ipynb
@@ -7,9 +7,9 @@
"source": [
"# Leveraging model distillation to fine-tune a model\n",
"\n",
- "OpenAI recently released **Distillation** which allows to leverage the outputs of a (large) model to fine-tune another (smaller) model. This can significantly reduce the price and the latency for specific tasks as you move to a smaller model. In this cookbook we'll look at a dataset, distill the output of gpt-4o to gpt-4o-mini and show how we can get significantly better results than on a generic, non-distilled, 4o-mini.\n",
+ "OpenAI **Distillation** uses the outputs of a larger model to fine-tune a smaller one. Moving to the smaller model can reduce latency and cost for specific tasks. In this cookbook, we'll distill `gpt-4o` outputs into `gpt-4o-mini` and compare the result with a generic, non-distilled `gpt-4o-mini` model.\n",
"\n",
- "We'll also leverage **Structured Outputs** for a classification problem using a list of enum. We'll see how fine-tuned model can benefit from structured output and how it will impact the performance. We'll show that **Structured Ouputs** work with all of those models, including the distilled one.\n",
+ "We'll also use **Structured Outputs** for classification with an enum. We'll measure how structured outputs affect the fine-tuned model and show that they work with each model, including the distilled one.\n",
"\n",
"We'll first analyze the dataset, get the output of both 4o and 4o mini, highlighting the difference in performance of both models, then proceed to the distillation and analyze the performance of this distilled model."
]
@@ -368,7 +368,7 @@
"id": "fdf208f5-0a70-41cb-b2c0-c340ee55d6d1",
"metadata": {},
"source": [
- "To get a understanding of the cost before running the queries, you can leverage tiktoken to understand the number of tokens we'll send and the cost associated to run this. This will only give you an estimate for to run the completions, not the fine-tuning process (used later in this cookbook when running the distillation), which depends on other factors such as the number of epochs, training set etc."
+ "Before running the queries, use tiktoken to estimate the token count and completion cost. This estimate does not include fine-tuning, whose cost also depends on factors such as the training-set size and number of epochs."
]
},
{
@@ -442,7 +442,7 @@
"source": [
"## Preparing functions to Store Completions\n",
"\n",
- "As we're looking at a limited list of response (enumerate list of grape varieties), let's leverage structured outputs so we make sure the model will answer from this list. This also allows us to compare the model's answer directly with the grape variety and have a deterministic answer (compared to a model that could answer \"I think the grape is Pinot Noir\" instead of just \"Pinot noir\"), on top of improving the performance to avoid grape varieties not in our dataset.\n",
+ "Because the response must be one of a fixed set of grape varieties, we'll use structured outputs to constrain the model to that set. This gives us a deterministic value to compare with the expected variety and prevents answers outside the dataset.\n",
"\n",
"If you want to know more on Structured Outputs you can read this [cookbook](https://cookbook.openai.com/examples/structured_outputs_intro) and this [documentation guide](https://platform.openai.com/docs/guides/structured-outputs/introduction)."
]
diff --git a/examples/Reinforcement_Fine_Tuning.ipynb b/examples/Reinforcement_Fine_Tuning.ipynb
index 64293cff..87d359d8 100644
--- a/examples/Reinforcement_Fine_Tuning.ipynb
+++ b/examples/Reinforcement_Fine_Tuning.ipynb
@@ -697,7 +697,7 @@
"\n",
"We can visualize the full score distribution on the training set.\n",
"\n",
- "> Note: In practice, analyzing model errors at scale often involves a mix of manual review and automated methods-like tagging failure types or clustering predictions by score and content. That workflow is beyond the scope of this guide, but it's a valuable next step once you've identified broad patterns."
+ "> Note: In practice, analyzing model errors at scale often involves a mix of manual review and automated methods, such as tagging failure types or clustering predictions by score and content. That workflow is beyond the scope of this guide, but it's a valuable next step once you've identified broad patterns."
]
},
{
@@ -2036,7 +2036,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Looking at the distruibution of scores, we observe that RFT helped shift the model’s predictions out of the mid-to-low score zone (0.2-0.6) and into the high range (0.8-1.0). Since the grader emphasizes clinical similarity over lexical match, this shift reflects stronger medical reasoning-not just better phrasing-according to our *expert* grader. As seen in the (0.0-0.1) range, a handful of already weak predictions fell even further, hinting at a residual knowledge gap.\n",
+ "The score distribution shows that RFT shifted the model’s predictions out of the mid-to-low range (0.2-0.6) and into the high range (0.8-1.0). Because the grader emphasizes clinical similarity over lexical match, our *expert* grader attributes this shift to stronger medical reasoning rather than better phrasing. A handful of already weak predictions fell into the 0.0-0.1 range, suggesting a residual knowledge gap.\n",
"\n",
"Note that, because the earlier `combined_grader` was designed to reward lexical correctness, its accuracy didnʼt improve much-which is expected. That gap reinforces why validating your model grader is critical, and why you should monitor for reward-hacking. In our case, we used `o3` to spot-check grading behavior, but domain expert review is essential. "
]
diff --git a/examples/Speech_transcription_methods.ipynb b/examples/Speech_transcription_methods.ipynb
index a2256300..5bbd9565 100644
--- a/examples/Speech_transcription_methods.ipynb
+++ b/examples/Speech_transcription_methods.ipynb
@@ -11,7 +11,7 @@
"\n",
"This notebook provides a clear, hands-on guide for beginners to quickly get started with Speech-to-Text (STT) using the OpenAI API. You'll explore multiple practical methods, their use cases, and considerations.\n",
"\n",
- "By the end you will be able to select and use the appropriate transcription method for your use use cases.\n",
+ "By the end, you will be able to select and use the appropriate transcription method for your use cases.\n",
"\n",
"*Note:*\n",
"- *This notebook uses WAV audio files for simplicity. It does **not** demonstrate real-time microphone streaming (such as from a web app or direct mic input).*\n",
diff --git a/examples/Structured_Outputs_Intro.ipynb b/examples/Structured_Outputs_Intro.ipynb
index cf424ed4..dc66684e 100644
--- a/examples/Structured_Outputs_Intro.ipynb
+++ b/examples/Structured_Outputs_Intro.ipynb
@@ -27,7 +27,7 @@
"\n",
"Structured Outputs can be useful in many ways, as you can rely on the outputs following a constrained schema.\n",
"\n",
- "If you used JSON mode or function calls before, you can think of Structured Outputs as a foolproof version of this.\n",
+ "Unlike JSON mode, Structured Outputs constrains the shape of the JSON, not only its validity.\n",
"\n",
"This can enable more robust flows in production-level applications, whether you are relying on function calls or expecting the output to follow a pre-defined structure.\n",
"\n",
diff --git a/examples/Structured_outputs_multi_agent.ipynb b/examples/Structured_outputs_multi_agent.ipynb
index 4316fcff..cb4e34e2 100644
--- a/examples/Structured_outputs_multi_agent.ipynb
+++ b/examples/Structured_outputs_multi_agent.ipynb
@@ -751,7 +751,7 @@
"\n",
"In this cookbook, we've explored how to leverage Structured Outputs to build more robust multi-agent systems.\n",
"\n",
- "Using this new feature allows to make sure that tool calls follow the specified schema and avoids having to handle edge cases or validate arguments on your side.\n",
+ "Structured Outputs ensures that tool calls follow the specified schema. Application code must still validate argument semantics and business rules.\n",
"\n",
"This can be applied to many more use cases, and we hope you can take inspiration from this to build your own use case!"
]
diff --git a/examples/codex/using_goals_in_codex.ipynb b/examples/codex/using_goals_in_codex.ipynb
index 328b0274..3fd447c9 100644
--- a/examples/codex/using_goals_in_codex.ipynb
+++ b/examples/codex/using_goals_in_codex.ipynb
@@ -200,7 +200,7 @@
"id": "76f0f050-2d37-475c-831e-47cee240e4e9",
"metadata": {},
"source": [
- "This is not just a request to improve performance. It gives Codex a measurable outcome, a verification surface, and a constraint. Codex can run the benchmark, inspect the hot path, make a targeted change, rerun the benchmark, run the correctness suite, and continue if the result is still not good enough.\n",
+ "This request asks for more than better performance. It gives Codex a measurable outcome, a verification surface, and a constraint. Codex can run the benchmark, inspect the hot path, make a targeted change, rerun the benchmark, run the correctness suite, and continue if the result is still not good enough.\n",
"\n",
"The practical mental model is simple:\n",
"\n",
@@ -246,7 +246,7 @@
"/goal Produce the strongest evidence-backed reproduction of the paper using the available materials and local resources. Attempt the headline results where feasible, verify outputs where possible, and end with a report that separates confirmed findings, approximate reconstructions, blocked claims, and remaining uncertainty.\n",
"```\n",
"\n",
- "That kind of Goal gives Codex room to investigate while keeping the final result honest. It does not just say \"keep going.\" It says what \"done,\" \"blocked,\" and \"still uncertain\" actually mean.\n",
+ "That kind of Goal gives Codex room to investigate while keeping the final result honest. It goes beyond \"keep going\" by defining what \"done,\" \"blocked,\" and \"still uncertain\" mean.\n",
"\n",
"When the task is clear but the Goal is not, Codex can help write the Goal itself. A simple two-step workflow works well: first, describe the work in plain language and ask Codex to turn it into a draft Goal; second, review that draft and tighten the success condition, verification surface, constraints, and blocked stop condition before activating it.\n",
"\n",
@@ -577,7 +577,7 @@
"id": "458719de-6e04-4ca4-8703-cf7c70f13741",
"metadata": {},
"source": [
- "That is the demo value of Goals in research. They let Codex keep working through ambiguity while preventing a plausible artifact from becoming an overclaimed conclusion. The Goal does not just ask Codex to finish. It defines what finished means: a claim-by-claim audit grounded in evidence, explicit about approximations, and honest about the boundary between reproduction and replay."
+ "That is the demo value of Goals in research. They let Codex keep working through ambiguity while preventing a plausible artifact from becoming an overclaimed conclusion. The Goal defines what finished means: a claim-by-claim audit grounded in evidence, explicit about approximations, and honest about the boundary between reproduction and replay."
]
},
{
diff --git a/examples/gpt-5/gpt-5_frontend.ipynb b/examples/gpt-5/gpt-5_frontend.ipynb
index 383d0b2a..227c71c1 100644
--- a/examples/gpt-5/gpt-5_frontend.ipynb
+++ b/examples/gpt-5/gpt-5_frontend.ipynb
@@ -315,7 +315,7 @@
"id": "6274e5f9",
"metadata": {},
"source": [
- "We hope this has given some ideas of how powerful GPT-5 is at frontend. From a single underspecified prompt and API call, we get production grade outputs. \n",
+ "A single underspecified prompt can generate frontend code in one API call, but production use still requires review and iteration.\n",
"\n",
"Now it's your turn - we can't wait to see what you'll build"
]
diff --git a/examples/mcp/mcp_tool_guide.ipynb b/examples/mcp/mcp_tool_guide.ipynb
index b7d018ab..18a1f601 100644
--- a/examples/mcp/mcp_tool_guide.ipynb
+++ b/examples/mcp/mcp_tool_guide.ipynb
@@ -541,7 +541,7 @@
"source": [
"## Conclusion\n",
"\n",
- "The hosted MCP tool in the Responses API turns external-service access from a bespoke plumbing task into a first-class capability of the API. By connecting to a remote server, letting the runtime cache its tool list, and trimming that list with `allowed_tools`, you eliminate the extra network hop, cut token overhead, and give the model a concise, discoverable action set. When combined with built-in tools such as `code_interpreter`, `web_search_preview`, or `image_gen`, MCP unlocks rich, multi-service workflows whether you’re analyzing sales data, triaging production errors, or automating checkout flows."
+ "The hosted MCP tool makes external services available through the Responses API. Connecting a remote server and letting the runtime cache its tool list avoids managing that network hop in application code. Using `allowed_tools` can reduce token overhead and gives the model a concise, discoverable action set. You can combine MCP with built-in tools such as `code_interpreter`, `web_search_preview`, or `image_gen` for multi-service workflows."
]
}
],
diff --git a/examples/partners/eval_driven_system_design/receipt_inspection.ipynb b/examples/partners/eval_driven_system_design/receipt_inspection.ipynb
index 86626645..ac5c5917 100644
--- a/examples/partners/eval_driven_system_design/receipt_inspection.ipynb
+++ b/examples/partners/eval_driven_system_design/receipt_inspection.ipynb
@@ -119,7 +119,7 @@
"\n",
"The solid arrows show the primary progressions or steps, while the dotted line \n",
"represents the ongoing nature of problem understanding - uncovering more about\n",
- "the customer domain will influence every step of the process. We wil examine \n",
+ "the customer domain will influence every step of the process. We will examine \n",
"several of these iterative cycles of refinement in detail below. \n",
"Not every project will proceed in the same way, but projects generally have some common\n",
"important components.\n",
diff --git a/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook.ipynb b/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook.ipynb
index 72aa39fc..3008b80c 100644
--- a/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook.ipynb
+++ b/examples/partners/mcp_powered_voice_agents/mcp_powered_agents_cookbook.ipynb
@@ -28,9 +28,9 @@
" - customer-facing assistants. \n",
"The latter of the two use cases, i.e. customer-facing assistants, tends to have a higher requirement for both accuracy, usability and design. Additionally, one common requirement for customer-facing chatbots is the need to add voice as a modality for user interface (i.e. for phone call automation).\n",
"\n",
- "These Q&A chatbots apply to a wide range of industries: healthcare, government, legal and other industries that requires a easy way for knowledge retrieval at a user's fingertips.\n",
+ "These Q&A chatbots apply to a wide range of industries, including healthcare, government, and legal services, that require an easy way to retrieve knowledge.\n",
"\n",
- "One such industry is the insurance industry, where we've seen tremendous value for customers we work with in the space. Insurance policies are complex and navigating the system can often be difficult for policy holders.\n",
+ "One such industry is insurance, where we've seen tremendous value for customers we work with in the space. Insurance policies are complex, and the system can be difficult for policyholders to navigate.\n",
"\n",
"### What's in this Cookbook?\n",
"In this cookbook, we provide an end-to-end modular recipe leveraging MCP for building voice-enabled agents using the [OpenAI Agents SDK](https://openai.github.io/openai-agents-python/). In particular, we demonstrate how we can use it for dynamic context management and using agentic tool-calling. We demonstrate the capabilities of such a system for the aforementioned insurance use-case. In this example, we demonstrate the use of MCP for various tools that you may want for your application. Specifically, we showcase the use of custom MCP servers (for text retrieval and web search) as well as using predefined MCP servers (for SQLite). "
@@ -941,7 +941,7 @@
"source": [
"### Contributors\n",
"\n",
- "This cookbook serves as a joint collaboration effort between OpenAI and [Brain Co](https://www.braincompany.ai/en/).\n",
+ "This cookbook is a joint effort by OpenAI and [Brain Co](https://www.braincompany.ai/en/).\n",
"\n",
"- [Cece Z](https://www.linkedin.com/in/cecez/)\n",
"- [Sibon Li](https://www.linkedin.com/in/sibon-li-9a9bba34/)\n",
diff --git a/examples/responses_api/responses_api_tool_orchestration.ipynb b/examples/responses_api/responses_api_tool_orchestration.ipynb
index 24e3f4c5..583e5d7b 100644
--- a/examples/responses_api/responses_api_tool_orchestration.ipynb
+++ b/examples/responses_api/responses_api_tool_orchestration.ipynb
@@ -896,7 +896,7 @@
"source": [
"As shown above, depending on the query, appropriate tool is invoked in order to determine the optimal response.\n",
"\n",
- "For instance, looking at the third example, when the model triggers the tool named \"PineconeSearchDocuments\", the code calls `query_pinecone_index` with the current query and then extracts the best match (or an appropriate context) as the result. For non health related inqueries or queries where explicit internet search is asked, the code calls the web_search_call function and for other queries, it may choose to not call any tool and rather provide a response based on the question under consideration.\n",
+ "For instance, in the third example, when the model calls `PineconeSearchDocuments`, the code passes the current query to `query_pinecone_index` and returns the best match as context. For general or non-health questions, or when the user explicitly asks for an internet search, the code calls `web_search_call`. For other questions, the model may answer without a tool.\n",
"\n",
"Finally, the tool call and its output are appended to the conversation, and the final answer is generated by the Responses API."
]
@@ -1170,7 +1170,7 @@
"metadata": {},
"source": [
"\n",
- "Here, we have seen how to utilize OpenAI's Responses API to implement a Retrieval-Augmented Generation (RAG) approach with multi-tool calling capabilities. It showcases an example where the model selects the appropriate tool based on the input query: general questions may be handled by built-in tools such as web-search, while specific medical inquiries related to internal knowledge are addressed by retrieving context from a vector database (such as Pinecone) via function calls. Additonally, we have showcased how multiple tool calls can be sequentially combined to generate a final response based on our instructions provided to responses API. \n",
+ "Here, we used OpenAI's Responses API to implement Retrieval-Augmented Generation (RAG) with multiple tools. The model selects a tool based on the query: built-in web search can handle general questions, while function calls can retrieve internal medical context from a vector database such as Pinecone. We also combined multiple tool calls in sequence to generate a final response from the instructions provided to the Responses API.\n",
"\n",
"As you continue to experiment and build upon these concepts, consider exploring additional resources and examples to further enhance your understanding and applications\n",
"\n",
diff --git a/examples/responses_api/responses_example.ipynb b/examples/responses_api/responses_example.ipynb
index cec44571..5b11366c 100644
--- a/examples/responses_api/responses_example.ipynb
+++ b/examples/responses_api/responses_example.ipynb
@@ -466,29 +466,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "With the responses API\n",
- "🔥 a single API call can handle:\n",
+ "With the Responses API, one request can analyze an image, call hosted web search, and summarize the results. The same workflow with Chat Completions requires the application to execute the tool call and submit its result in another request.\n",
"\n",
- "✅ Analyze a given image using a multimodal input.\n",
+ "The diagram below compares the two flows.\n",
"\n",
- "✅ Perform web search via the `web_search` hosted tool\n",
- "\n",
- "✅ Summarize the results.\n",
- "\n",
- "In contrast, With Chat Completions API would require multiple steps, each requiring a round trip to the API:\n",
- "\n",
- "1️⃣ Upload image and get analysis → 1 request\n",
- "\n",
- "2️⃣ Extract info, call external web search → manual step + tool execution\n",
- "\n",
- "3️⃣ Re-submit tool results for summarization → another request\n",
- "\n",
- "See the following diagram for a side by side visualized comparison!\n",
- "\n",
- "![Responses vs Completions](../../images/comparisons.png)\n",
- "\n",
- "\n",
- "We are very excited for you to try out the Responses API and see how it can simplify your code and make it easier to build complex, multimodal, tool-augmented interactions!\n"
+ "![Responses vs Completions](../../images/comparisons.png)\n"
]
},
{