In short.
This is OpenAI's official guide to prompt engineering for its text-generation API. It is written for developers building with the API and is also useful to beginners who want to learn how instructions shape a model's answer. Its main catch is that it is specific to OpenAI's API, model names and deprecation timeline. The captured page explains how to send a prompt with the Responses API, how the instructions parameter and the developer and user roles differ in priority, how to structure prompts with Markdown and XML, when to use few-shot examples and retrieved context, where to place reusable content for prompt caching, and how to choose between reasoning and GPT models. The page supplies code samples in several languages and sample outputs, but it gives no benchmarks, prices, latency figures or test results, and the samples were not run for this report. The evidence supports a clear introduction to the API's prompting model in the captured page. Whether it is still technically accurate today is unknown without checking the linked model and deprecation references, and the evidence does not show how well any technique performs.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete selected scope: the single Markdown page at https://developers.openai.com/api/docs/guides/prompt-engineering.md, 37,405 bytes, captured 12 November 2026, including its inline text, embedded code samples and sample outputs. No licence, copyright notice or terms of use were captured; the page includes a reusable-prompt deprecation notice. Excluded: linked pages and other folders, including the latest-model guide, reasoning best practices, Structured Outputs, file search, prompt caching, the prompt object migration guide, the deprecations page, the model spec, the API reference, the OpenAI Cookbook, the Playground, the libraries page and the models listing. Untested: every code sample, API behaviour, SDK compatibility and version, model availability and output quality. The sample outputs are only the page's own illustrations.
The overview
identity
The resource is a single web page: the OpenAI API documentation guide titled 'Prompt engineering', captured as Markdown from https://developers.openai.com/api/docs/guides/prompt-engineering.md. Its stated purpose is to explain how to use a large language model through the OpenAI API to generate text, code, structured JSON or prose, and how to write prompts that give consistent results. The page opens with a comparison to ChatGPT for readers who have only used the chat interface, then moves into code.
The publisher is OpenAI, shown by the domain and by the page's references to OpenAI models, the Responses API and OpenAI's model spec. The captured text does not state an individual author, a guide version number or a licence. Unknown from the evidence: the guide's version, its first publication date and its last edit date.
assessment
The page is a complete guide rather than a stub or marketing page. It explains core concepts, names a set of techniques, gives templates for developer messages, includes a few-shot classification example, and provides code in six programming languages plus curl and an 'openai responses create' CLI command.
Its strongest value is for readers who will call the OpenAI API and want a vendor-supplied model of how instructions are prioritised. Its weakest points are the lack of measured evidence and the heavy reliance on OpenAI's own model names and features, including one that the page says is being deprecated. The page presents its advice as guidance, and the evidence does not show how well each technique works on any task.
users
Beginners: the page explains that a prompt is an instruction to a model and that generated content is non-deterministic, describing prompting as 'a mix of art and science'. It uses plain comparisons. A developer message is like a function definition and user messages are like its arguments. A reasoning model is like a senior co-worker, while a GPT model is like a junior one. The captured page does not explain API keys, account setup or SDK installation, so beginners will need to learn those basics elsewhere.
Experienced developers: the page contains practical details. The output array can hold several item types, so text should not be read at output[0].content[0].text. Some of OpenAI's official SDKs include an output_text convenience property. Instructions apply only to the current response. Production applications should pin model snapshots, and prompts should live in code with tests and evaluations. Teams using a non-OpenAI provider will find the API-specific detail less transferable, although the page states that some techniques, such as using message roles, work with every model.
capabilities
Prompt construction: the page describes the instructions parameter, which gives high-level guidance on tone, goals and examples. It also describes the message roles (developer, user and assistant); under the model spec it links, developer messages are prioritised ahead of user messages. It recommends a developer-message structure of Identity, Instructions, Examples and Context, and says Markdown headers and XML tags can mark the boundaries between sections and between supporting documents.
Techniques covered: few-shot learning, with a worked example that labels product reviews as Positive, Negative or Neutral; adding context to a prompt, either by querying a vector database or by using OpenAI's file search tool; planning for the context window, which the page measures in tokens; and Structured Outputs for JSON through a linked guide. It also gives short guidance for coding, front-end work and agentic tasks, including planning, preambles and TODO tracking.
Operational guidance: place reusable content at the start of a prompt to benefit from prompt caching; keep production prompts in code with typed inputs, code review, tests and staged rollouts; pin model snapshots; and build evaluation suites before changing prompts. The page does not measure the results of these practices.
Using it
requirements
Access: the examples call the OpenAI endpoint at https://api.openai.com/v1/responses with a bearer token read from the OPENAI_API_KEY environment variable, so you need an OpenAI account and API key to run them. The captured page does not say how to get a key, how much usage costs, or what rate or account limits apply.
Software: the page shows code for JavaScript, Python, Go (openai-go/v3), Java, C#, Ruby, curl and an 'openai responses create' CLI command. It gives no install commands. The Go import specifies SDK major version v3; exact package releases and minimum runtime versions are not supplied. The page links to a libraries page that was not captured.
Model access: the examples use the model name gpt-6-astra, which the page calls a strong default for general text generation. The evidence does not show whether that model is available to a given account, region or plan.
mechanism
A request sends a model name and an input to the Responses API. The model returns an output array that can contain message items, tool calls and reasoning items, so the page warns against assuming the reply sits at output[0].content[0].text. The page says some of OpenAI's official SDKs include an output_text convenience property that combines all text outputs into one string. The samples do not show one universal accessor: the Go sample calls OutputText(), the C# sample calls GetOutputText() and the Java sample streams through the output items. Use the text accessor of the SDK you choose.
Priority of instructions: the instructions parameter takes priority over the input parameter and can carry tone, goals and example responses. It applies only to the current request. When conversation state is managed with previous_response_id, earlier instructions are not carried over. Message roles follow a similar split: developer messages hold the application's rules and are prioritised ahead of user messages, which carry the end user's inputs and configuration.
Model behaviour: reasoning models generate an internal chain of thought to analyse complex, multi-step tasks, but are generally slower and more expensive. GPT models are fast and cost-efficient but benefit from explicit instructions. The page does not explain how either family works internally beyond these descriptions, so those details are unknown from the evidence. Because output is non-deterministic, the page recommends building tests and evaluation suites that measure prompt behaviour rather than trusting a single response.
setup
The examples show the minimum setup: get an OpenAI API key, export it as OPENAI_API_KEY, install an official SDK for your language or use curl, then call the Responses API with a model and an input string. The captured page does not show SDK install commands, so the exact steps for each language are unknown from this evidence.
Configuration choices the page recommends: choose between reasoning and GPT models and between large and mini or nano sizes; set reasoning effort (the pirate example uses low); pin a specific snapshot such as gpt-4.1-2025-04-14 for production; and keep prompt builders in a small module near the feature they support. It recommends code-managed prompts over reusable prompt objects, which OpenAI is deprecating.
Test setup: the page advises building tests and evaluation suites that measure prompt behaviour before changing production prompts. It does not supply a test harness, fixtures or evaluation data, so readers must write their own.
example
The basic example asks the model to 'Write a one-sentence bedtime story about a unicorn.' using gpt-6-astra through the Responses API. The page shows a sample reply: one assistant message with an output_text item containing a one-sentence story about a unicorn named Luna. This is an illustration. The page does not say it came from a test run, and it was not run for this report.
A second example sets instructions to 'Talk like a pirate.' with reasoning effort low and asks 'Are semicolons optional in JavaScript?'. The page then shows the same request written as two input messages, a developer message and a user message, and says the two are roughly equivalent.
A few-shot example uses a developer message to classify product reviews as Positive, Negative or Neutral, with three labelled examples and a rule to output one word only. A longer template asks a coding assistant to use snake_case variable names and the older var keyword for an Internet Explorer 6 target. These examples show prompt structure, not measured accuracy, and their results on real data are unknown.
Assessment & evidence
limitations
Vendor specificity: the code, parameters (instructions, reasoning effort, previous_response_id), output shapes and model names are specific to OpenAI's API. The page states that some prompt engineering techniques, such as using message roles, work with every model. It also notes that different model types, and even different snapshots within the same family, may need different prompting. These are the publisher's assertions, and the page reports no comparative testing to support them. Whether the general ideas, such as clear instructions, examples, structure and context, carry over to other providers is not tested on the page.
Dated or inconsistent references: the examples use gpt-6-astra, while the front-end section refers to GPT-5. The page cites a model spec dated 2025-02-12, an example snapshot dated 2025-04-14 and context windows for 'newer GPT-4.1 models'. It refers readers to separate model documentation for current window sizes, so the latest figures are unknown from this evidence.
Evidence gap: advice on reasoning versus GPT models, Markdown and XML formatting, role priority and context structure is stated as best practice without benchmarks, error rates or comparisons. The coding, front-end and agentic sections are short summaries that defer to a separate latest-model guide, which was not captured. The code samples were not run, so whether they compile and how they behave at runtime is untested.
reasoning
The page fits the Learning resources category: it is a guide that explains concepts and gives practical templates, rather than software to install or a dataset. Its subject, prompting large language models to generate text, is generative AI.
In the captured text, the guide is complete and detailed. It offers explicit conceptual models for newcomers, specific API details for developers, and clear warnings about output arrays and instruction scope. The evidence does not establish whether its model references, such as gpt-6-astra, the gpt-4.1 snapshot example and the GPT-4.1 context-window figure, or its deprecation timeline are still current; the freshness section covers this. Its deprecation notice concerns reusable prompt objects, which the page itself advises against for new work, so the notice does not by itself make the rest of the guide obsolete. The page says a separate guide gives the fuller current treatment of the newest model, so this page is a general guide rather than the reference for the newest model.
Its value depends on the reader using OpenAI's API. The page is best read as a set of vendor recommendations: this report credits it for clarity and structure, not for proven results or confirmed current accuracy.
alternatives
The page points to other OpenAI resources that were not captured and were not assessed: the latest-model prompting best practices guide, reasoning best practices, Structured Outputs, the file search tool guide, the prompt caching guide, the prompt object migration guide, the deprecations page, the model spec, the API reference, the OpenAI Cookbook and the Playground.
The page describes the OpenAI Cookbook as linking to third-party prompting libraries and guides, video courses and papers on advanced prompting for reasoning. The evidence does not compare this guide with those resources or with prompt-engineering material from other vendors, so no claim is made about which is better.
Within this page, the advice changes with the model family: reasoning models suit high-level goals, while GPT models need explicit instructions. Readers who use only one model family may need the model-specific guidance the page links to, which was not captured.
evidence
The evidence is one captured copy of the Markdown version of the prompt engineering page at the stated address, captured on 12 November 2026. It consists of OpenAI's first-party explanations of its API and prompting practices, code samples in several languages, and illustrative outputs such as the unicorn bedtime story reply and the few-shot review labels.
The page is the publisher's own documentation. It contains no independent measurement, audit, user study or benchmark, and its sample outputs are illustrations rather than recorded test results. Claims such as 'a strong default' and 'maximize cost and latency savings' are the publisher's assertions and are reported as such.
Access & freshness
costs
Unknown: the captured page gives no prices, per-token rates, rate limits, subscription fees or free-tier details. It refers readers to the models listing for model information, and that listing was not captured.
Relative statements only: reasoning models are described as generally slower and more expensive than GPT models. Placing reusable content at the start of a prompt is said to help maximise cost and latency savings through prompt caching. Context window sizes vary by model, and the page cites up to one million tokens for newer GPT-4.1 models. The page gives no figure for any saving or cost.
rights
The captured copy contains no licence, copyright notice or terms of use. The evidence therefore does not establish whether the page's text and code samples may be reused, copied or redistributed, and this should be checked at the source site.
The page is OpenAI documentation captured from its public address. It references OpenAI's model spec and the OpenAI Cookbook, which are separate resources not covered here. This report makes no claim about distribution rights.
freshness
The page was captured on 12 November 2026. It carries dated notices: prompt creation is to be de-emphasised from 3 June 2026, and the v1/prompts endpoint is scheduled to shut down on 30 November 2026, 18 days after capture. The page points to a deprecations page for the current timeline. That page was not captured, so any later change to the timeline is unknown.
Model currency: the page uses gpt-6-astra as its default and example model, and gpt-4.1-2025-04-14 as a snapshot example. The captured page does not show which models are current when a reader uses this guide, or whether gpt-6-astra is still available; readers should check the models listing.
The page shows no last-updated date or version history, so how often it changes is unknown.
actions
If you are new to prompting: start with the instructions parameter and add one or two worked examples in the few-shot pattern the page shows. Read the reply through your chosen SDK's text accessor and check it before relying on it. The page says some official SDKs include an output_text convenience property, but the samples use different accessors in different languages.
If you are building on the API: check the current model list and deprecations page before copying model names, pin model snapshots for production, and keep prompts in version-controlled code. As the page notes, move any saved prompt objects off the v1/prompts endpoint before 30 November 2026. Read the output array rather than assuming the text sits at a fixed index.
Before relying on any technique, run your own tests. The samples were not run for this report, and the page does not measure the effect of its advice. Build an evaluation set that reflects your own data and compare prompt versions before rolling out changes.
