Repository Public
1# Using GPT-5.423> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45## Introduction67[GPT-5.4](https://developers.openai.com/api/docs/models/gpt-5.4) was released as a frontier model for professional work across the API and Codex. It helps developers analyze complex information, build production software, and automate multi-step workflows.89Within the GPT-5.4 generation, `gpt-5.4` is the general-purpose model for workflows that move between software engineering, reasoning, writing, and tool use.1011This guide covers key features of the GPT-5 model family and how to get the most out of GPT-5.4.1213## What's new1415Compared with the previous GPT-5.2 model, GPT-5.4 shows improvements in:1617- Coding, document understanding, tool use, and instruction following18- Image perception and multimodal tasks19- Long-running task execution and multi-step agent workflows20- Token efficiency and end-to-end performance on tool-heavy workloads21- Web search and multi-source synthesis for hard-to-locate information22- Document-heavy and spreadsheet-heavy business workflows in customer service, analytics, and finance2324GPT-5.4 brings the coding capabilities of GPT-5.3-Codex to our flagship frontier model. Developers can generate production-quality code, build polished front-end UI, follow repo-specific patterns, and handle multi-file changes with fewer retries. It also has a strong out-of-the-box coding personality, so teams spend less time on prompt tuning.2526For agentic workloads, GPT-5.4 reduces end-to-end time across multi-step trajectories and often completes tasks with fewer tokens and tool calls. This makes agents more responsive and lowers the cost of operating complex workflows at scale in the API and Codex.2728### New features in GPT-5.42930Like earlier GPT-5 models, GPT-5.4 supports custom tools, parameters to control verbosity and reasoning, and an allowed tools list. GPT-5.4 also introduces several capabilities that make it easier to build powerful agent systems, operate over larger bodies of information, and run more reliable automated workflows:3132- **`tool_search` in the API:** GPT-5.4 improves tool search for larger tool ecosystems by using deferred tool loading. This makes tools searchable, loads only the relevant definitions, reduces token usage, and improves tool selection accuracy in real deployments. Learn more in the [tool search guide](https://developers.openai.com/api/docs/guides/tools-tool-search).33- **1M token context window:** GPT-5.4 supports up to a 1M token context window, making it easier to analyze entire codebases, long document collections, or extended agent trajectories in a single request. Read more in the [1M context window](#1m-context-window) section.34- **Built-in computer use:** GPT-5.4 is the first mainline model with built-in computer-use capabilities, enabling agents to interact directly with software to complete, verify, and fix tasks in a build-run-verify-fix loop. Learn more in the [computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use).35- **Native compaction support:** GPT-5.4 is the first mainline model trained to support compaction, enabling longer agent trajectories while preserving key context.3637## Model, API, and feature updates3839Within this model generation, `gpt-5.4` is the general-purpose model for both broad tasks and coding. For more difficult problems, `gpt-5.4-pro` uses more compute to think longer and provide more consistent answers.4041For smaller, faster variants, start with `gpt-5.4-mini` or `gpt-5.4-nano`.4243To help you pick the model that best fits your use case, consider these tradeoffs:4445| Variant | Best for |46| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |47| [`gpt-5.4`](https://developers.openai.com/api/docs/models/gpt-5.4) | General-purpose work, including complex reasoning, broad world knowledge, and code-heavy or multi-step agentic tasks |48| [`gpt-5.4-pro`](https://developers.openai.com/api/docs/models/gpt-5.4-pro) | Tough problems that may take longer to solve and need deeper reasoning |49| [`gpt-5.4-mini`](https://developers.openai.com/api/docs/models/gpt-5.4-mini) | High-volume coding, computer use, and agent workflows that still need strong reasoning |50| [`gpt-5.4-nano`](https://developers.openai.com/api/docs/models/gpt-5.4-nano) | High-throughput tasks where speed and cost matter most |5152### Lower reasoning effort5354The `reasoning.effort` parameter controls how many reasoning tokens the model generates before producing a response. Earlier reasoning models like o3 supported only `low`, `medium`, and `high`: `low` favored speed and fewer tokens, while `high` favored more thorough reasoning.5556GPT-5.2 and GPT-5.4 support `none` as their lowest reasoning effort for lower-latency interactions. It is the default setting for both models. If you need more thinking, slowly increase to `medium` and experiment with results.5758With reasoning effort set to `none`, prompting is important. To improve the model's reasoning quality, even with the default settings, encourage it to “think” or outline its steps before answering.5960Reasoning effort set to none6162```javascript63import OpenAI from "openai";64const openai = new OpenAI();6566const response = await openai.responses.create({67 model: "gpt-5.4",68 input:69 "Think carefully and outline your steps before answering. How much gold would it take to coat the Statue of Liberty in a 1mm layer?",70 reasoning: {71 effort: "none",72 },73});7475console.log(response);76```7778```python79from openai import OpenAI8081client = OpenAI()8283response = client.responses.create(84 model="gpt-5.4",85 input="Think carefully and outline your steps before answering. How much gold would it take to coat the Statue of Liberty in a 1mm layer?",86 reasoning={"effort": "none"},87)8889print(response)90```9192```go93package main9495import (96 "context"97 "fmt"9899 "github.com/openai/openai-go/v3"100 "github.com/openai/openai-go/v3/responses"101 "github.com/openai/openai-go/v3/shared"102)103104func main() {105 client := openai.NewClient()106 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{107 Model: "gpt-5.4",108 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Think carefully and outline your steps before answering. How much gold would it take to coat the Statue of Liberty in a 1mm layer?")},109 Reasoning: shared.ReasoningParam{Effort: shared.ReasoningEffortNone},110 })111 if err != nil {112 panic(err)113 }114 fmt.Println(response)115}116```117118```java119import com.openai.client.OpenAIClient;120import com.openai.client.okhttp.OpenAIOkHttpClient;121import com.openai.models.Reasoning;122import com.openai.models.ReasoningEffort;123import com.openai.models.responses.ResponseCreateParams;124125ResponseCreateParams params =126 ResponseCreateParams.builder()127 .model("gpt-5.4")128 .input("Explain the bug and propose a fix.")129 .reasoning(Reasoning.builder().effort(ReasoningEffort.NONE).build())130 .build();131132client.responses().create(params).output().stream()133 .flatMap(item -> item.message().stream())134 .flatMap(message -> message.content().stream())135 .flatMap(content -> content.outputText().stream())136 .forEach(text -> System.out.println(text.text()));137```138139```csharp140using OpenAI.Responses;141#pragma warning disable OPENAI001142143string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;144ResponsesClient client = new(key);145146CreateResponseOptions options = new()147{148 Model = "gpt-5.4",149 ReasoningOptions = new ResponseReasoningOptions150 {151 ReasoningEffortLevel = ResponseReasoningEffortLevel.None,152 },153};154options.InputItems.Add(155 ResponseItem.CreateUserMessageItem(156 "Think carefully and outline your steps before answering. How much gold would it take to coat the Statue of Liberty in a 1mm layer?"157 )158);159160ResponseResult response = await client.CreateResponseAsync(options);161Console.WriteLine(response.GetOutputText());162```163164```ruby165require "openai"166167client = OpenAI::Client.new168response = client.responses.create(169 model: "gpt-5.4",170 reasoning: { effort: :minimal },171 input: "Explain the bug and propose a fix."172)173puts(response.output_text)174```175176```bash177curl --request POST \178 --url https://api.openai.com/v1/responses \179 --header "Authorization: Bearer $OPENAI_API_KEY" \180 --header 'Content-type: application/json' \181 --data '{182 "model": "gpt-5.4",183 "input": "Think carefully and outline your steps before answering. How much gold would it take to coat the Statue of Liberty in a 1mm layer?",184 "reasoning": {185 "effort": "none"186 }187}'188```189190191### Verbosity192193Verbosity determines how many output tokens are generated. Lowering the number of tokens reduces overall latency. While the model's reasoning approach stays mostly the same, the model finds ways to answer more concisely—which can either improve or diminish answer quality, depending on your use case. Here are some scenarios for both ends of the verbosity spectrum:194195- **High verbosity:** Use when you need the model to provide thorough explanations of documents or perform extensive code refactoring.196- **Low verbosity:** Best for situations where you want concise answers or focused code generation, such as SQL queries.197198GPT-5 made this option configurable as one of `high`, `medium`, or `low`. With GPT-5.4, verbosity remains configurable and defaults to `medium`.199200When generating code with GPT-5.4, `medium` and `high` verbosity levels yield longer, more structured code with inline explanations, while `low` verbosity produces shorter, more concise code with minimal commentary.201202Control verbosity203204```javascript205import OpenAI from "openai";206const openai = new OpenAI();207208const response = await openai.responses.create({209 model: "gpt-5.4",210 input:211 "What is the answer to the ultimate question of life, the universe, and everything?",212 text: {213 verbosity: "low",214 },215});216217console.log(response);218```219220```python221from openai import OpenAI222223client = OpenAI()224225response = client.responses.create(226 model="gpt-5.4",227 input="What is the answer to the ultimate question of life, the universe, and everything?",228 text={"verbosity": "low"},229)230231print(response)232```233234```go235package main236237import (238 "context"239 "fmt"240241 "github.com/openai/openai-go/v3"242 "github.com/openai/openai-go/v3/responses"243)244245func main() {246 client := openai.NewClient()247 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{248 Model: "gpt-5.4",249 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is the answer to the ultimate question of life, the universe, and everything?")},250 Text: responses.ResponseTextConfigParam{Verbosity: responses.ResponseTextConfigVerbosityLow},251 })252 if err != nil {253 panic(err)254 }255 fmt.Println(response)256}257```258259```java260import com.openai.client.OpenAIClient;261import com.openai.client.okhttp.OpenAIOkHttpClient;262import com.openai.models.responses.ResponseCreateParams;263import com.openai.models.responses.ResponseTextConfig;264265ResponseCreateParams params =266 ResponseCreateParams.builder()267 .model("gpt-5.4")268 .input("Explain the bug and propose a fix.")269 .text(ResponseTextConfig.builder().verbosity(ResponseTextConfig.Verbosity.LOW).build())270 .build();271272client.responses().create(params).output().stream()273 .flatMap(item -> item.message().stream())274 .flatMap(message -> message.content().stream())275 .flatMap(content -> content.outputText().stream())276 .forEach(text -> System.out.println(text.text()));277```278279```ruby280require "openai"281282client = OpenAI::Client.new283response = client.responses.create(284 model: "gpt-5.4",285 text: { verbosity: :low },286 input: "Explain the bug and propose a fix."287)288puts(response.output_text)289```290291```bash292curl --request POST \293 --url https://api.openai.com/v1/responses \294 --header "Authorization: Bearer $OPENAI_API_KEY" \295 --header 'Content-type: application/json' \296 --data '{297 "model": "gpt-5.4",298 "input": "What is the answer to the ultimate question of life, the universe, and everything?",299 "text": {300 "verbosity": "low"301 }302}'303```304305306You can still steer verbosity through prompting after setting it to `low` in the API. The verbosity parameter defines a general token range at the system prompt level, but the actual output is flexible to both developer and user prompts within that range.307308#### 1M context window3093101M token context window was introduced with GPT-5.4, making it easier to analyze entire codebases, long document collections, or extended agent trajectories in a single request.311312We have separate standard pricing for requests under 272K and over 272K tokens, available in the [pricing docs](https://developers.openai.com/api/docs/pricing). If you use [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode), any prompt above 272K tokens is automatically processed at standard rates.313314Long context pricing stacks with other pricing modifiers such as data residency and batch.315316We have different rate limits for requests under 272K tokens and over 272K tokens; this is available on the [GPT-5.4 model page](https://developers.openai.com/api/docs/models/gpt-5.4).317318## Using tools with GPT-5.4319320GPT-5.4 has been post-trained on specific tools. See the [tools docs](https://developers.openai.com/api/docs/guides/tools) for more specific guidance.321322### Computer use tool323324Computer use lets GPT-5.4 operate software through the user interface by inspecting screenshots and returning structured actions for your harness to execute. It is a good fit for browser or desktop workflows where a person could complete the task through the UI, such as navigating a site, filling out forms, or validating that a change actually worked.325326Use it in an isolated browser or VM, and keep a human in the loop for high-impact actions. The full guide covers the built-in Responses API loop, custom harness patterns, and code-execution-based setups.327328[Computer use guide329330331332 Learn how to run the built-in computer tool safely and integrate it with333 your own harness.](https://developers.openai.com/api/docs/guides/tools-computer-use)334335### Tool search tool336337Tool search lets GPT-5.4 defer large tool surfaces until runtime so the model loads only the definitions it needs. This is most useful when you have many functions, `namespaces`, or MCP tools and want to reduce token usage, preserve cache performance, and improve latency without exposing every schema up front.338339Use hosted tool search when the candidate tools are already known at request time, or client-executed tool search when your application needs to decide what to load dynamically. The full guide also covers best practices for `namespaces`, MCP servers, and deferred loading.340341[Tool search guide342343344345 Learn how to defer tool definitions and load the right subset at runtime.](https://developers.openai.com/api/docs/guides/tools-tool-search)346347### Custom tools348349When the GPT-5 model family launched, we introduced a new capability called custom tools, which lets models send any raw text as tool call input but still constrain outputs if desired. This tool behavior remains true in GPT-5.4.350351[Function calling guide352353354355 Learn about custom tools in the function calling guide.](https://developers.openai.com/api/docs/guides/function-calling)356357#### Freeform inputs358359Define your tool with `type: custom` to enable models to send plaintext inputs directly to your tools, rather than being limited to structured JSON. The model can send any raw text—code, SQL queries, shell commands, configuration files, or long-form prose—directly to your tool.360361```json362{363 "type": "custom",364 "name": "code_exec",365 "description": "Executes arbitrary python code"366}367```368369#### Constraining outputs370371GPT-5.4 supports context-free grammars (`CFGs`) for custom tools, letting you provide a Lark grammar to constrain outputs to a specific syntax or DSL. Attaching a CFG, for example a SQL or DSL grammar, ensures the assistant's text matches your grammar.372373This enables precise, constrained tool calls or structured responses and lets you enforce strict syntactic or domain-specific formats directly in GPT-5.4's function calling, improving control and reliability for complex or constrained domains.374375#### Best practices for custom tools376377- **Write concise, explicit tool descriptions.** The model chooses what to send based on your description; state explicitly if you want it to always call the tool.378- **Validate outputs on the server side**. Freeform strings are powerful but require safeguards against injection or unsafe commands.379380### Allowed tools381382The `allowed_tools` parameter under `tool_choice` lets you pass N tool definitions but restrict the model to only M (< N) of them. List your full toolkit in `tools`, and then use an `allowed_tools` block to name the subset and specify a mode—either `auto` (the model may pick any of those) or `required` (the model must invoke one).383384[Function calling guide385386387388 Learn about the allowed tools option in the function calling guide.](https://developers.openai.com/api/docs/guides/function-calling)389390By separating all possible tools from the subset that can be used _now_, you gain greater safety, predictability, and improved prompt caching. You also avoid brittle prompt engineering, such as hard-coded call order. GPT-5.4 dynamically invokes or requires specific functions mid-conversation while reducing the risk of unintended tool usage over long contexts.391392| | **Standard Tools** | **Allowed Tools** |393| ---------------- | ----------------------------------------- | ------------------------------------------------------------- |394| Model's universe | All tools listed under **`"tools": […]`** | Only the subset under **`"tools": […]`** in **`tool_choice`** |395| Tool invocation | Model may or may not call any tool | Model restricted to (or required to call) chosen tools |396| Purpose | Declare available capabilities | Constrain which capabilities are actually used |397398```json399{400 "tool_choice": {401 "type": "allowed_tools",402 "mode": "auto",403 "tools": [404 { "type": "function", "name": "get_weather" },405 { "type": "function", "name": "search_docs" }406 ]407 }408}409```410411For a more detailed overview of all of these new features, see the [prompt guidance for GPT-5.4](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-5.4#prompting-best-practices).412413### Preambles414415Preambles are brief, user-visible explanations that GPT-5.4 generates before invoking any tool or function, outlining its intent or plan—for example, “why I'm calling this tool.” They appear after the chain of thought and before the actual tool call, making the model's reasoning easier to understand and debug while supporting precise steering.416417By letting GPT-5.4 “think out loud” before each tool call, preambles boost tool-calling accuracy (and overall task success) without bloating reasoning overhead. To enable preambles, add a system or developer instruction—for example: “Before you call a tool, explain why you are calling it.” GPT-5.4 adds a concise rationale to each specified tool call. The model may also output multiple messages between tool calls, which can enhance the interaction experience—particularly for minimal reasoning or latency-sensitive use cases.418419For more on using preambles, see the [GPT-5 prompting cookbook](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide#tool-preambles).420421## Migration quickstart422423GPT-5.4 works best with the Responses API, which supports preserving reasoning context between turns to improve performance. Read below to migrate from your current model or API.424425### Migrating from other models to GPT-5.4426427Use the [OpenAI Docs428 skill](https://github.com/openai/skills/tree/main/skills/.system/openai-docs)429 when migrating existing prompts or workflows to GPT-5.4. It's available in our430 public skills repository and the Codex desktop app.431432While the model should be close to a drop-in replacement for GPT-5.2, there are a few key changes to call out. See [Prompt guidance for GPT-5.4](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-5.4#prompting-best-practices) for specific updates to make in your prompts.433434Using GPT-5 models with the Responses API provides improved intelligence because of the API design. The Responses API can pass the previous turn's CoT to the model. This leads to fewer generated reasoning tokens, higher cache hit rates, and less latency. To learn more, see an [in-depth guide](https://developers.openai.com/cookbook/examples/responses_api/reasoning_items) on the benefits of the Responses API.435436When migrating to GPT-5.4 from an older OpenAI model, start by experimenting with reasoning levels and prompting strategies. Use the [prompt optimizer](https://platform.openai.com/chat/edit?models=gpt-5.4&optimize=true) to update your prompts for GPT-5.4 based on current best practices, then follow this model-specific guidance:437438- **`gpt-5.2`**: `gpt-5.4` with default settings is meant to be a drop-in replacement.439- **o3**: `gpt-5.4` with `medium` or `high` reasoning. Start with `medium` reasoning with prompt tuning, then increase to `high` if you aren't getting the results you want.440- **`gpt-4.1`**: `gpt-5.4` with `none` reasoning. Start with `none` and tune your prompts; increase if you need better performance.441- **`o4-mini` or `gpt-4.1-mini`**: `gpt-5.4-mini` with prompt tuning is a great replacement.442- **`gpt-4.1-nano`**: `gpt-5.4-nano` with prompt tuning is a great replacement.443444### New `phase` parameter445446For long-running or tool-heavy GPT-5.4 flows in the Responses API, use the assistant message `phase` field to avoid early stopping and other misbehavior.447448`phase` is optional at the API level, but we highly recommend using it. Use `phase: "commentary"` for intermediate assistant updates (such as preambles before tool calls) and `phase: "final_answer"` for the completed answer. Do not add `phase` to user messages.449450If you use `previous_response_id`, that is usually the simplest path because451 prior assistant state is preserved. If you replay assistant history manually,452 preserve each original `phase` value.453454Missing or dropped `phase` can cause preambles to be treated as final answers455in those workflows. For additional guidance and examples, see the [GPT-5.4456prompting guide](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-5.4#phase-parameter).457458Round-trip assistant phase values459460```javascript461import OpenAI from "openai";462const client = new OpenAI();463464const response = await client.responses.create({465 model: "gpt-5.4",466 input: [467 {468 role: "assistant",469 phase: "commentary",470 content:471 "I’ll inspect the logs and then summarize root cause and remediation.",472 },473 {474 role: "assistant",475 phase: "final_answer",476 content: "Root cause: cache invalidation race.",477 },478 {479 role: "user",480 content: "Great—now give me a rollout-safe fix plan.",481 },482 ],483});484485console.log(response.output_text);486```487488```python489from openai import OpenAI490491client = OpenAI()492493response = client.responses.create(494 model="gpt-5.4",495 input=[496 {497 "role": "assistant",498 "phase": "commentary",499 "content": "I’ll inspect the logs and then summarize root cause and remediation.",500 },501 {502 "role": "assistant",503 "phase": "final_answer",504 "content": "Root cause: cache invalidation race.",505 },506 {507 "role": "user",508 "content": "Great—now give me a rollout-safe fix plan.",509 },510 ],511)512513print(response.output_text)514```515516```go517package main518519import (520 "context"521 "fmt"522523 "github.com/openai/openai-go/v3"524 "github.com/openai/openai-go/v3/responses"525)526527func main() {528 client := openai.NewClient()529 commentary := responses.ResponseInputItemParamOfMessage(530 "I’ll inspect the logs and then summarize root cause and remediation.",531 responses.EasyInputMessageRoleAssistant,532 )533 commentary.OfMessage.Phase = responses.EasyInputMessagePhaseCommentary534 finalAnswer := responses.ResponseInputItemParamOfMessage(535 "Root cause: cache invalidation race.",536 responses.EasyInputMessageRoleAssistant,537 )538 finalAnswer.OfMessage.Phase = responses.EasyInputMessagePhaseFinalAnswer539540 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{541 Model: "gpt-5.4",542 Input: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{543 commentary,544 finalAnswer,545 responses.ResponseInputItemParamOfMessage("Great—now give me a rollout-safe fix plan.", responses.EasyInputMessageRoleUser),546 }},547 })548 if err != nil {549 panic(err)550 }551 fmt.Println(response.OutputText())552}553```554555```java556import com.openai.client.OpenAIClient;557import com.openai.client.okhttp.OpenAIOkHttpClient;558import com.openai.models.Reasoning;559import com.openai.models.ReasoningEffort;560import com.openai.models.responses.ResponseCreateParams;561562ResponseCreateParams params =563 ResponseCreateParams.builder()564 .model("gpt-5.4")565 .input("Explain the bug and propose a fix.")566 .reasoning(Reasoning.builder().effort(ReasoningEffort.MEDIUM).build())567 .build();568569client.responses().create(params).output().stream()570 .flatMap(item -> item.message().stream())571 .flatMap(message -> message.content().stream())572 .flatMap(content -> content.outputText().stream())573 .forEach(text -> System.out.println(text.text()));574```575576```ruby577require "openai"578579client = OpenAI::Client.new580response = client.responses.create(581 model: "gpt-5.4",582 reasoning: { effort: :medium },583 input: "Explain the bug and propose a fix."584)585puts(response.output_text)586```587588589### GPT-5.4 parameter compatibility590591The following parameters are **only supported** when using GPT-5.4 with reasoning effort set to `none`:592593- `temperature`594- `top_p`595- `logprobs`596597Requests that include these fields will raise an error for GPT-5.4 or GPT-5.2 with any other reasoning effort setting, or for older GPT-5 models such as `gpt-5`, `gpt-5-mini`, or `gpt-5-nano`.598599To achieve similar results with reasoning effort set higher, or with another GPT-5 family model, try these alternative parameters:600601- **Reasoning depth:** `reasoning: { effort: "none" | "low" | "medium" | "high" | "xhigh" }`602- **Output verbosity:** `text: { verbosity: "low" | "medium" | "high" }`603- **Output length:** `max_output_tokens`604605### Migrating from Chat Completions to Responses API606607The biggest difference, and main reason to migrate from Chat Completions to the Responses API for GPT-5.4, is support for passing chain of thought (CoT) between turns. See a full [comparison of the APIs](https://developers.openai.com/api/docs/guides/migrate-to-responses).608609Passing CoT exists only in the Responses API, and we've seen improved intelligence, fewer generated reasoning tokens, higher cache hit rates, and lower latency as a result of doing so. Most other parameters remain at parity, though the formatting is different. Here's how new parameters are handled differently between Chat Completions and the Responses API:610611**Reasoning effort**612613614615Responses API616617 Generate response with reasoning effort set to none618619```bash620curl --request POST \621 --url https://api.openai.com/v1/responses \622 --header "Authorization: Bearer $OPENAI_API_KEY" \623 --header "Content-type: application/json" \624 --data '{625 "model": "gpt-5.4",626 "input": "How much gold would it take to coat the Statue of Liberty in a 1mm layer?",627 "reasoning": {628 "effort": "none"629 }630}'631```632633 634635 636637 638Chat Completions639640 Generate response with reasoning effort set to none641642```bash643curl --request POST \644 --url https://api.openai.com/v1/chat/completions \645 --header "Authorization: Bearer $OPENAI_API_KEY" \646 --header "Content-type: application/json" \647 --data '{648 "model": "gpt-5.4",649 "messages": [650 {651 "role": "user",652 "content": "How much gold would it take to coat the Statue of Liberty in a 1mm layer?"653 }654 ],655 "reasoning_effort": "none"656}'657```658659660661**Verbosity**662663664665Responses API666667 Control verbosity668669```bash670curl --request POST \671 --url https://api.openai.com/v1/responses \672 --header "Authorization: Bearer $OPENAI_API_KEY" \673 --header "Content-type: application/json" \674 --data '{675 "model": "gpt-5.4",676 "input": "What is the answer to the ultimate question of life, the universe, and everything?",677 "text": {678 "verbosity": "low"679 }680}'681```682683 684685 686687 688Chat Completions689690 Control verbosity691692```bash693curl --request POST \694 --url https://api.openai.com/v1/chat/completions \695 --header "Authorization: Bearer $OPENAI_API_KEY" \696 --header "Content-type: application/json" \697 --data '{698 "model": "gpt-5.4",699 "messages": [700 {701 "role": "user",702 "content": "What is the answer to the ultimate question of life, the universe, and everything?"703 }704 ],705 "verbosity": "low"706}'707```708709710711**Custom tools**712713714715Responses API716717 Custom tool call718719```bash720curl --request POST \721 --url https://api.openai.com/v1/responses \722 --header "Authorization: Bearer $OPENAI_API_KEY" \723 --header "Content-type: application/json" \724 --data '{725 "model": "gpt-5.4",726 "input": "Use the code_exec tool to calculate the area of a circle with radius equal to the number of r letters in blueberry",727 "tools": [728 {729 "type": "custom",730 "name": "code_exec",731 "description": "Executes arbitrary Python code"732 }733 ]734}'735```736737 738739 740741 742Chat Completions743744 Custom tool call745746```bash747curl --request POST \748 --url https://api.openai.com/v1/chat/completions \749 --header "Authorization: Bearer $OPENAI_API_KEY" \750 --header "Content-type: application/json" \751 --data '{752 "model": "gpt-5.4",753 "messages": [754 {755 "role": "user",756 "content": "Use the code_exec tool to calculate the area of a circle with radius equal to the number of r letters in blueberry"757 }758 ],759 "tools": [760 {761 "type": "custom",762 "custom": {763 "name": "code_exec",764 "description": "Executes arbitrary Python code"765 }766 }767 ]768}'769```770771772773## Prompting best practices774775When troubleshooting cases where GPT-5.4 treats an intermediate update as the776 final answer, verify your integration preserves the assistant message `phase`777 field correctly. See [Phase parameter](#phase-parameter) for details.778779### Understand GPT-5.4 behavior780781#### Where GPT-5.4 is strongest782783GPT-5.4 tends to work especially well in these areas:784785- Strong personality and tone adherence, with less drift over long answers786- Agentic workflow robustness, with a stronger tendency to stick with multi-step work, retry, and complete agent loops end to end787- Evidence-rich synthesis, especially in long-context or multi-tool workflows788- Instruction adherence in modular, skill-based, and block-structured prompts when the contract is explicit789- Long-context analysis across large, messy, or multi-document inputs790- Batched or parallel tool calling while maintaining tool-call accuracy791- Spreadsheet, finance, and Excel workflows that need instruction following, formatting fidelity, and stronger self-verification792793#### Where explicit prompting still helps794795Even with those strengths, GPT-5.4 benefits from more explicit guidance in a few recurring patterns:796797- Low-context tool routing early in a session, when tool selection can be less reliable798- Dependency-aware workflows that need explicit prerequisite and downstream-step checks799- Reasoning effort selection, where higher effort is not always better and the right choice depends on task shape, not intuition800- Research tasks that require disciplined source collection and consistent citations801- Irreversible or high-impact actions that require verification before execution802- Terminal or coding-agent environments where tool boundaries must stay clear803804These patterns are observed defaults, not guarantees. Start with the smallest prompt that passes your evals, and add blocks only when they fix a measured failure mode.805806### Use core prompt patterns807808#### Keep outputs compact and structured809810To improve token efficiency with GPT-5.4, constrain verbosity and enforce structured output through clear output contracts. In practice, this acts as an additional control layer alongside the `verbosity` parameter in the Responses API, allowing you to guide both how much the model writes and how it structures the output.811812```xml813<output_contract>814- Return exactly the sections requested, in the requested order.815- If the prompt defines a preamble, analysis block, or working section, do not treat it as extra output.816- Apply length limits only to the section they are intended for.817- If a format is required (JSON, Markdown, SQL, XML), output only that format.818</output_contract>819820<verbosity_controls>821- Prefer concise, information-dense writing.822- Avoid repeating the user's request.823- Keep progress updates brief.824- Do not shorten the answer so aggressively that required evidence, reasoning, or completion checks are omitted.825</verbosity_controls>826```827828#### Set clear defaults for follow-through829830Users often change the task, format, or tone mid-conversation. To keep the assistant aligned, define clear rules for when to proceed, when to ask, and how newer instructions override earlier defaults.831832Use a default follow-through policy like this:833834```xml835<default_follow_through_policy>836- If the user’s intent is clear and the next step is reversible and low-risk, proceed without asking.837- Ask permission only if the next step is:838 (a) irreversible,839 (b) has external side effects (for example sending, purchasing, deleting, or writing to production), or840 (c) requires missing sensitive information or a choice that would materially change the outcome.841- If proceeding, briefly state what you did and what remains optional.842</default_follow_through_policy>843```844845Make instruction priority explicit:846847```xml848<instruction_priority>849- User instructions override default style, tone, formatting, and initiative preferences.850- Safety, honesty, privacy, and permission constraints do not yield.851- If a newer user instruction conflicts with an earlier one, follow the newer instruction.852- Preserve earlier instructions that do not conflict.853</instruction_priority>854```855856Higher-priority developer or system instructions remain binding.857858**Guidance:** When instructions change mid-conversation, make the update explicit, scoped, and local. State what changed, what still applies, and whether the change affects the next turn or the rest of the conversation.859860#### Handle mid-conversation instruction updates861862For mid-conversation updates, use explicit, scoped steering messages that state:8638641. Scope8652. Override8663. Carry forward867868```text869<task_update>870For the next response only:871- Do not complete the task.872- Only produce a plan.873- Keep it to 5 bullets.874875All earlier instructions still apply unless they conflict with this update.876</task_update>877```878879If the task itself changes, say so directly:880881```text882<task_update>883The task has changed.884Previous task: complete the workflow.885Current task: review the workflow and identify risks only.886887Rules for this turn:888- Do not execute actions.889- Do not call destructive tools.890- Return exactly:891 1. Main risks892 2. Missing information893 3. Recommended next step894</task_update>895```896897#### Make tool use persistent when correctness depends on it898899Use explicit rules to keep tool use thorough, dependency-aware, and appropriately paced, especially in workflows where later actions rely on earlier retrieval or verification. A common failure mode is skipping prerequisites because the right end state seems obvious.900901GPT-5.4 can be less reliable at tool routing early in a session, when context is still thin. Prompt for prerequisites, dependency checks, and exact tool intent.902903```xml904<tool_persistence_rules>905- Use tools whenever they materially improve correctness, completeness, or grounding.906- Do not stop early when another tool call is likely to materially improve correctness or completeness.907- Keep calling tools until:908 (1) the task is complete, and909 (2) verification passes (see <verification_loop>).910- If a tool returns empty or partial results, retry with a different strategy.911</tool_persistence_rules>912```913914This is especially important for workflows where the final action depends on earlier lookup or retrieval steps. One of the most common failure modes is skipping prerequisites because the intended end state seems obvious.915916```xml917<dependency_checks>918- Before taking an action, check whether prerequisite discovery, lookup, or memory retrieval steps are required.919- Do not skip prerequisite steps just because the intended final action seems obvious.920- If the task depends on the output of a prior step, resolve that dependency first.921</dependency_checks>922```923924Prompt for parallelism when the work is independent and wall-clock matters. Prompt for sequencing when dependencies, ambiguity, or irreversible actions matter more than speed.925926```xml927<parallel_tool_calling>928- When multiple retrieval or lookup steps are independent, prefer parallel tool calls to reduce wall-clock time.929- Do not parallelize steps that have prerequisite dependencies or where one result determines the next action.930- After parallel retrieval, pause to synthesize the results before making more calls.931- Prefer selective parallelism: parallelize independent evidence gathering, not speculative or redundant tool use.932</parallel_tool_calling>933```934935#### Force completeness on long-horizon tasks936937For multi-step workflows, a common failure mode is incomplete execution: the model finishes after partial coverage, misses items in a batch, or treats empty or narrow retrieval as final. GPT-5.4 becomes more reliable when the prompt defines explicit completion rules and recovery behavior.938939Coverage can be achieved through sequential or parallel retrieval, but completion rules should remain explicit either way.940941```xml942<completeness_contract>943- Treat the task as incomplete until all requested items are covered or explicitly marked [blocked].944- Keep an internal checklist of required deliverables.945- For lists, batches, or paginated results:946 - determine expected scope when possible,947 - track processed items or pages,948 - confirm coverage before finalizing.949- If any item is blocked by missing data, mark it [blocked] and state exactly what is missing.950</completeness_contract>951```952953For workflows where empty, partial, or noisy retrieval is common:954955```xml956<empty_result_recovery>957If a lookup returns empty, partial, or suspiciously narrow results:958- do not immediately conclude that no results exist,959- try at least one or two fallback strategies,960 such as:961 - alternate query wording,962 - broader filters,963 - a prerequisite lookup,964 - or an alternate source or tool,965- Only then report that no results were found, along with what you tried.966</empty_result_recovery>967```968969#### Add a verification loop before high-impact actions970971Once the workflow appears complete, add a lightweight verification step before returning the answer or taking an irreversible action. This helps catch requirement misses, grounding issues, and format drift before commit.972973```xml974<verification_loop>975Before finalizing:976- Check correctness: does the output satisfy every requirement?977- Check grounding: are factual claims backed by the provided context or tool outputs?978- Check formatting: does the output match the requested schema or style?979- Check safety and irreversibility: if the next step has external side effects, ask permission first.980</verification_loop>981```982983```xml984<missing_context_gating>985- If required context is missing, do NOT guess.986- Prefer the appropriate lookup tool when the missing context is retrievable; ask a minimal clarifying question only when it is not.987- If you must proceed, label assumptions explicitly and choose a reversible action.988</missing_context_gating>989```990991For agents that actively take actions, add a short execution frame:992993```xml994<action_safety>995- Pre-flight: summarize the intended action and parameters in 1-2 lines.996- Execute via tool.997- Post-flight: confirm the outcome and any validation that was performed.998</action_safety>999```10001001### Handle specialized workflows10021003#### Choose image detail explicitly for vision and computer use10041005If your workflow depends on visual precision, specify the image `detail` level in the prompt or integration instead of relying on `auto`. Use `high` for standard high-fidelity image understanding. Use `original` for large, dense, or spatially sensitive images, especially [computer use, localization, OCR, and click-accuracy tasks](https://developers.openai.com/api/docs/guides/tools-computer-use) on `gpt-5.4` and future models. Use `low` only when speed and cost matter more than fine detail. For more details on image detail levels, see the [Images and Vision guide](https://developers.openai.com/api/docs/guides/images-vision).10061007#### Lock research and citations to retrieved evidence10081009When citation quality matters, make both the source boundary and the format requirement explicit. This helps reduce fabricated references, unsupported claims, and citation-format drift.10101011```xml1012<citation_rules>1013- Only cite sources retrieved in the current workflow.1014- Never fabricate citations, URLs, IDs, or quote spans.1015- Use exactly the citation format required by the host application.1016- Attach citations to the specific claims they support, not only at the end.1017</citation_rules>1018```10191020```xml1021<grounding_rules>1022- Base claims only on provided context or tool outputs.1023- If sources conflict, state the conflict explicitly and attribute each side.1024- If the context is insufficient or irrelevant, narrow the answer or say you cannot support the claim.1025- If a statement is an inference rather than a directly supported fact, label it as an inference.1026</grounding_rules>1027```10281029If your application requires inline citations, require inline citations. If it requires footnotes, require footnotes. The key is to lock the format and prevent the model from improvising unsupported references.10301031#### Research mode10321033Push GPT-5.4 into a disciplined research mode. Use this pattern for research, review, and synthesis tasks. Do not force it onto short execution tasks or simple deterministic transforms.10341035```xml1036<research_mode>1037- Do research in 3 passes:1038 1) Plan: list 3-6 sub-questions to answer.1039 2) Retrieve: search each sub-question and follow 1-2 second-order leads.1040 3) Synthesize: resolve contradictions and write the final answer with citations.1041- Stop only when more searching is unlikely to change the conclusion.1042</research_mode>1043```10441045If your host environment uses a specific research tool or requires a submit step, combine this with the host's finalization contract.10461047#### Clamp strict output formats10481049For SQL, JSON, or other parse-sensitive outputs, tell GPT-5.4 to emit only the target format and check it before finishing.10501051```text1052<structured_output_contract>1053- Output only the requested format.1054- Do not add prose or markdown fences unless they were requested.1055- Validate that parentheses and brackets are balanced.1056- Do not invent tables or fields.1057- If required schema information is missing, ask for it or return an explicit error object.1058</structured_output_contract>1059```10601061If you are extracting document regions or OCR boxes, define the coordinate system and add a drift check:10621063```text1064<bbox_extraction_spec>1065- Use the specified coordinate format exactly, such as [x1,y1,x2,y2] normalized to 0..1.1066- For each box, include page, label, text snippet, and confidence.1067- Add a vertical-drift sanity check so boxes stay aligned with the correct line of text.1068- If the layout is dense, process page by page and do a second pass for missed items.1069</bbox_extraction_spec>1070```10711072#### Keep tool boundaries explicit in coding and terminal agents10731074In coding agents, GPT-5.4 works better when the rules for shell access and file editing are unambiguous. This is especially important when you expose tools like [Shell](https://developers.openai.com/api/docs/guides/tools-shell) or [Apply patch](https://developers.openai.com/api/docs/guides/tools-apply-patch).10751076#### User updates10771078GPT-5.4 does well with brief, outcome-based updates. Reuse the user-updates pattern from the 5.2 guide, but pair it with explicit completion and verification requirements.10791080Recommended update spec:10811082```xml1083<user_updates_spec>1084- Only update the user when starting a new major phase or when something changes the plan.1085- Each update: 1 sentence on outcome + 1 sentence on next step.1086- Do not narrate routine tool calls.1087- Keep the user-facing status short; keep the work exhaustive.1088</user_updates_spec>1089```10901091For coding agents, see the Prompting patterns for coding tasks section below for more specific guidance.10921093#### Prompting patterns for coding tasks10941095**Autonomy and persistence**10961097GPT-5.4 is generally more thorough end to end than earlier mainline models on coding and tool-use tasks, so you often need less explicit "verify everything" prompting. Still, for high-stakes changes such as production, migrations, or security work, keep a lightweight verification clause.10981099```xml1100<autonomy_and_persistence>1101Persist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.11021103Unless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.1104</autonomy_and_persistence>1105```11061107**Intermediary updates**11081109Keep updates sparse and high-signal. In coding tasks, prefer updates at key points.11101111```xml1112<user_updates_spec>1113- Intermediary updates go to the `commentary` channel.1114- User updates are short updates while you are working. They are not final answers.1115- Use 1-2 sentence updates to communicate progress and new information while you work.1116- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements ("Done -", "Got it", or "Great question") or similar framing.1117- Before exploring or doing substantial work, send a user update explaining your understanding of the request and your first step. Avoid commenting on the request or starting with phrases such as "Got it" or "Understood."1118- Provide updates roughly every 30 seconds while working.1119- When exploring, explain what context you are gathering and what you learned. Vary sentence structure so the updates do not become repetitive.1120- When working for a while, keep updates informative and varied, but stay concise.1121- When work is substantial, provide a longer plan after you have enough context. This is the only update that may be longer than 2 sentences and may contain formatting.1122- Before file edits, explain what you are about to change.1123- While thinking, keep the user informed of progress without narrating every tool call. Even if you are not taking actions, send frequent progress updates rather than going silent, especially if you are thinking for more than a short stretch.1124- Keep the tone of progress updates consistent with the assistant's overall personality.1125</user_updates_spec>1126```11271128**Formatting**11291130GPT-5.4 often defaults to more structured formatting and may overuse bullet lists. If you want a clean final response, explicitly clamp list shape.11311132```xml1133Never use nested bullets. Keep lists flat (single level). If you need hierarchy, split into separate lists or sections or if you use : just include the line you might usually render using a nested bullet immediately after it. For numbered lists, only use the `1. 2. 3.` style markers (with a period), never `1)`.1134```11351136**Frontend tasks**11371138Use this only when additional frontend guidance is useful.11391140```xml1141<frontend_tasks>1142When doing frontend design tasks, avoid generic, overbuilt layouts.11431144Use these hard rules:1145- One composition: The first viewport must read as one composition, not a dashboard, unless it is a dashboard.1146- Brand first: On branded pages, the brand or product name must be a hero-level signal, not just nav text or an eyebrow. No headline should overpower the brand.1147- Brand test: If the first viewport could belong to another brand after removing the nav, the branding is too weak.1148- Full-bleed hero only: On landing pages and promotional surfaces, the hero image should usually be a dominant edge-to-edge visual plane or background. Do not default to inset hero images, side-panel hero images, rounded media cards, tiled collages, or floating image blocks unless the existing design system clearly requires them.1149- Hero budget: The first viewport should usually contain only the brand, one headline, one short supporting sentence, one CTA group, and one dominant image. Do not place stats, schedules, event listings, address blocks, promos, "this week" callouts, metadata rows, or secondary marketing content there.1150- No hero overlays: Do not place detached labels, floating badges, promo stickers, info chips, or callout boxes on top of hero media.1151- Cards: Default to no cards. Never use cards in the hero unless they are the container for a user interaction. If removing a border, shadow, background, or radius does not hurt interaction or understanding, it should not be a card.1152- One job per section: Each section should have one purpose, one headline, and usually one short supporting sentence.1153- Real visual anchor: Imagery should show the product, place, atmosphere, or context.1154- Reduce clutter: Avoid pill clusters, stat strips, icon rows, boxed promos, schedule snippets, and competing text blocks.1155- Use motion to create presence and hierarchy, not noise. Ship 2-3 intentional motions for visually led work, and prefer Framer Motion when it is available.11561157Exception: If working within an existing website or design system, preserve the established patterns, structure, and visual language.1158</frontend_tasks>1159```11601161```xml1162<terminal_tool_hygiene>1163- Only run shell commands via the terminal tool.1164- Never "run" tool names as shell commands.1165- If a patch or edit tool exists, use it directly; do not attempt it in bash.1166- After changes, run a lightweight verification step such as ls, tests, or a build before declaring the task done.1167</terminal_tool_hygiene>1168```11691170#### Document localization and OCR boxes11711172For bbox tasks, be explicit about coordinate conventions and add drift tests.11731174```xml1175<bbox_extraction_spec>1176- Use the specified coordinate format exactly (for example [x1,y1,x2,y2] normalized 0..1).1177- For each bbox, include: page, label, text snippet, confidence.1178- Add a vertical-drift sanity check:1179 - ensure bboxes align with the line of text (not shifted up or down).1180- If dense layout, process page by page and do a second pass for missed items.1181</bbox_extraction_spec>1182```11831184#### Use runtime and API integration notes11851186For long-running or tool-heavy agents, the runtime contract matters as much as the prompt contract.11871188##### Phase parameter11891190For GPT-5.4, `gpt-5.3-codex`, and later Responses models, the `phase` field can1191help in the small number of long-running or tool-heavy flows where preambles or1192other intermediate assistant updates are mistaken for the final answer.11931194- `phase` is optional at the API level, but it is highly recommended. Best-effort inference may exist server-side, but explicit round-tripping of `phase` is strictly better.1195- Use `phase` for long-running or tool-heavy agents that may emit commentary before tool calls or before a final answer.1196- Preserve `phase` when replaying prior assistant items so the model can distinguish working commentary from the completed answer. This matters most in multi-step flows with preambles, tool-related updates, or multiple assistant messages in the same turn.1197- Do not add `phase` to user messages.1198- If you use `previous_response_id`, that is usually the simplest path, since OpenAI can often recover prior state without manually replaying assistant items.1199- If you replay assistant history yourself, preserve the original `phase` values.1200- Missing or dropped `phase` can cause preambles to be interpreted as final answers and degrade behavior on those multi-step tasks.12011202#### Preserve behavior in long sessions12031204Compaction unlocks significantly longer effective context windows, where user conversations can persist for many turns without hitting context limits or long-context performance degradation, and agents can perform very long trajectories that exceed a typical context window for long-running, complex tasks.12051206If you are using [Compaction](https://developers.openai.com/api/docs/guides/compaction) in the Responses API, compact after major milestones, treat compacted items as opaque state, and keep prompts functionally identical after compaction. The endpoint is ZDR compatible and returns an `encrypted_content` item that you can pass into future requests. GPT-5.4 tends to remain more coherent and reliable over longer, multi-turn conversations with fewer breakdowns as sessions grow.12071208For more guidance, see the [`/responses/compact` API reference](https://developers.openai.com/api/reference/resources/responses/methods/compact).12091210#### Control personality for customer-facing workflows12111212GPT-5.4 can be steered more effectively when you separate persistent personality from per-response writing controls. This is especially useful for customer-facing workflows such as emails, support replies, announcements, and blog-style content.12131214- **Personality (persistent):** sets the default tone, verbosity, and decision style across the session.1215- **Writing controls (per response):** define the channel, register, formatting, and length for a specific artifact.1216- **Reminder:** personality should not override task-specific output requirements. If the user asks for JSON, return JSON.12171218For natural, high-quality prose, the highest-leverage controls are:12191220- Give the model a clear persona.1221- Specify the channel and emotional register.1222- Explicitly ban formatting when you want prose.1223- Use hard length limits.12241225```xml1226<personality_and_writing_controls>1227- Persona: <one sentence>1228- Channel: <Slack | email | memo | PRD | blog>1229- Emotional register: <direct/calm/energized/etc.> + "not <overdo this>"1230- Formatting: <ban bullets/headers/markdown if you want prose>1231- Length: <hard limit, e.g. <=150 words or 3-5 sentences>1232- Default follow-through: if the request is clear and low-risk, proceed without asking permission.1233</personality_and_writing_controls>1234```12351236For more personality patterns you can lift directly, see the [Prompt Personalities cookbook](https://developers.openai.com/cookbook/examples/gpt-5/prompt_personalities).12371238**Professional memo mode**12391240For memos, reviews, and other professional writing tasks, general writing instructions are often not enough. These workflows benefit from explicit guidance on specificity, domain conventions, synthesis, and calibrated certainty.12411242```xml1243<memo_mode>1244- Write in a polished, professional memo style.1245- Use exact names, dates, entities, and authorities when supported by the record.1246- Follow domain-specific structure if one is requested.1247- Prefer precise conclusions over generic hedging.1248- When uncertainty is real, tie it to the exact missing fact or conflicting source.1249- Synthesize across documents rather than summarizing each one independently.1250</memo_mode>1251```12521253This mode is especially useful for legal, policy, research, and executive-facing writing, where the goal is not just fluency, but disciplined synthesis and clear conclusions.12541255### Tune reasoning and migration12561257#### Treat reasoning effort as a last-mile knob12581259Reasoning effort is not one-size-fits-all. Treat it as a last-mile tuning knob, not the primary way to improve quality. In many cases, stronger prompts, clear output contracts, and lightweight verification loops recover much of the performance teams might otherwise seek through higher reasoning settings.12601261Recommended defaults:12621263- `none`: Best for fast, cost-sensitive, latency-sensitive tasks where the model does not need to think.1264- `low`: Works well for latency-sensitive tasks where a small amount of thinking can produce a meaningful accuracy gain, especially with complex instructions.1265- `medium` or `high`: Reserve for tasks that truly require stronger reasoning and can absorb the latency and cost tradeoff. Choose between them based on how much performance gain your task gets from additional reasoning.1266- `xhigh`: Avoid as a default unless your evals show clear benefits. It is best suited for long, agentic, reasoning-heavy tasks where maximum intelligence matters more than speed or cost.12671268In practice, most teams should default to the `none`, `low`, or `medium` range.12691270Start with `none` for execution-heavy workloads such as workflow steps, field extraction, support triage, and short structured transforms.12711272Start with `medium` or higher for research-heavy workloads such as long-context synthesis, multi-document review, conflict resolution, and strategy writing. With `medium` and a well-engineered prompt, you can squeeze out a lot of performance.12731274For GPT-5.4 workloads, `none` can already perform well on action-selection and tool-discipline tasks. If your workload depends on nuanced interpretation, such as implicit requirements, ambiguity, or cancelled-tool-call recovery, start with `low` or `medium` instead.12751276Before increasing reasoning effort, first add:12771278- `<completeness_contract>`1279- `<verification_loop>`1280- `<tool_persistence_rules>`12811282If the model still feels too literal or stops at the first plausible answer, add an initiative nudge before raising reasoning effort:12831284```xml1285<dig_deeper_nudge>1286- Don’t stop at the first plausible answer.1287- Look for second-order issues, edge cases, and missing constraints.1288- If the task is safety or accuracy critical, perform at least one verification step.1289</dig_deeper_nudge>1290```12911292#### Migrate prompts to GPT-5.4 one change at a time12931294Use the same one-change-at-a-time discipline as the 5.2 guide: switch model first, pin `reasoning_effort`, run evals, then iterate.12951296These starting points work well for many migrations:12971298| Current setup | Suggested GPT-5.4 start | Notes |1299| ------------------------- | ---------------------------------- | ------------------------------------------------------------------- |1300| `gpt-5.2` | Match the current reasoning effort | Preserve the existing latency and quality profile first, then tune. |1301| `gpt-5.3-codex` | Match the current reasoning effort | For coding workflows, keep the reasoning effort the same. |1302| `gpt-4.1` or `gpt-4o` | `none` | Keep snappy behavior, and increase only if evals regress. |1303| Research-heavy assistants | `medium` or `high` | Use explicit research multi-pass and citation gating. |1304| Long-horizon agents | `medium` or `high` | Add tool persistence and completeness accounting. |13051306#### Small-model guidance for `gpt-5.4-mini` and `gpt-5.4-nano`13071308`gpt-5.4-mini` and `gpt-5.4-nano` are highly steerable, but they are less likely than larger models to infer missing steps, resolve ambiguity implicitly, or package outputs the way you intended unless you specify that behavior directly. In practice, prompts for smaller models are often a bit longer and more explicit.13091310**How `gpt-5.4-mini` differs**13111312- `gpt-5.4-mini` is more literal and makes fewer assumptions.1313- It is strong when the task is clearly structured, but weaker on implicit workflows and ambiguity handling.1314- By default, it may try to keep the conversation going with a follow-up question unless you suppress that behavior explicitly.13151316**Prompting `gpt-5.4-mini`**13171318- Put critical rules first.1319- Specify the full execution order when tool use or side effects matter.1320- Do not rely on "you MUST" alone. Use structural scaffolding such as numbered steps, decision rules, and explicit action definitions.1321- Separate "do the action" from "report the action."1322- Show the correct flow, not just the final format.1323- Define ambiguity behavior explicitly: when to ask, abstain, or proceed.1324- Specify packaging directly: answer length, whether to ask a follow-up question, citation style, and section order.1325- Be careful with `output nothing else`. Prefer scoped instructions such as `after the final JSON, output nothing further`.13261327**Prompting `gpt-5.4-nano`**13281329- Use `gpt-5.4-nano` only for narrow, well-bounded tasks.1330- Prefer closed outputs: labels, enums, short JSON, or fixed templates.1331- Avoid multi-step orchestration unless the flow is extremely constrained.1332- Route ambiguous or planning-heavy tasks to a stronger model instead of over-prompting `gpt-5.4-nano`.13331334**Good default pattern**133513361. Task13372. Critical rule13383. Exact step order13394. Edge cases or clarification behavior13405. Output format13416. One correct example13421343**Avoid**13441345- Implied next steps1346- Unspecified edge cases1347- Schema-only prompts for tool workflows1348- Generic instructions without structure13491350#### Web search and deep research13511352If you are migrating a research agent in particular, make these prompt updates before increasing reasoning effort:13531354- Add `<research_mode>`1355- Add `<citation_rules>`1356- Add `<empty_result_recovery>`1357- Increase `reasoning_effort` one notch only after prompt fixes.13581359You can start from the 5.2 research block and then layer in citation gating and finalization contracts as needed.13601361GPT-5.4 performs especially well when the task requires multi-step evidence gathering, long-context synthesis, and explicit prompt contracts. In practice, the highest-leverage prompt changes are choosing reasoning effort by task shape, defining exact output and citation formats, adding dependency-aware tool rules, and making completion criteria explicit. The model is often strong out of the box, but it is most reliable when prompts clearly specify how to search, how to verify, and what counts as done.13621363### Next steps13641365- Review [Model, API, and feature updates](#model-api-and-feature-updates) for model capabilities, parameters, and API compatibility details.1366- Read [Prompt engineering](https://developers.openai.com/api/docs/guides/prompt-engineering) for broader prompting strategies that apply across model families.1367- Read [Compaction](https://developers.openai.com/api/docs/guides/compaction) if you are building long-running GPT-5.4 sessions in the Responses API.13681369## Further reading13701371[GPT-5.3-Codex prompting guide](https://developers.openai.com/cookbook/examples/gpt-5/codex_prompting_guide)13721373[GPT-5.4 blog post](https://openai.com/index/introducing-gpt-5-4/)13741375[GPT-5 frontend guide](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_frontend)13761377[GPT-5 model family: new features guide](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_new_params_and_tools)13781379[Cookbook on reasoning models](https://developers.openai.com/cookbook/examples/responses_api/reasoning_items)13801381[Comparison of Responses API vs. Chat Completions](https://developers.openai.com/api/docs/guides/migrate-to-responses)