OpenAI: prompt engineering best practices
Official guidance on writing instructions, supplying context, specifying format, and using examples.
Compute College
How clear instructions, examples, constraints, and output formats help an AI model complete a task.
Prompt engineering is the practice of designing instructions that help an AI model understand what task to perform, what information to use, what rules to follow, and what the final answer should look like. A prompt can include the task, relevant background, constraints, examples, the desired format, and quality or acceptance criteria. Prompt engineering does not change the model’s trained weights — it changes the instructions and information provided to the model for the current request or workflow.
Memory trick: Prompt engineering tells the model what job to do and what a successful result looks like.
A capable model can still produce a weak answer when the request is vague, contradictory, or missing necessary information. Prompt design also affects compute economics: longer prompts consume more input tokens, uncontrolled responses generate unnecessary output tokens, and repeated attempts to correct a poor result add more token usage, latency, and cost. The objective is not the longest possible prompt — it is the smallest set of clear instructions needed to produce a reliable result.
Consider the request "Review this report." The model does not know what kind of review is needed, who will read it, which risks matter, or what format to produce. A more useful prompt: "Review the attached report for an executive audience. Identify the three most important findings, two material risks, and any unsupported claims. Return a short executive summary followed by a table of findings and evidence."
Example figures are illustrative calculations, not current quoted market prices.
Current example
OpenAI publishes prompt-engineering guidance describing the practice as designing and refining the inputs that guide a model’s response, with clear instructions, relevant context, a desired format, and examples as the levers that improve results. Use these as terminology references; they are vendor guidance, not independent measurements of any specific workload.
Official guidance on writing instructions, supplying context, specifying format, and using examples.
A longer walkthrough of structuring a prompt and refining it against real tasks.
The ComputeTape lesson that converts prompt size and response length into a priced unit.
Source discipline: prompt-design guidance is vendor documentation. Cost and latency effects vary by workload, model, and provider — measure your own before generalizing.
Market signal
Prompt engineering can change the amount of inference work needed to complete a task. The most useful metric is often not cost per token or cost per request — it is the total cost of producing one acceptable result.
Market read: better prompts can reduce retries and wasted tokens, but long prompt templates and large examples can increase input-token demand. Measure the complete workflow rather than assuming a longer prompt is automatically better. Figures here are illustrative unless explicitly sourced and dated — see our methodology.
A common mistake is treating prompt engineering as a collection of magic phrases. Instructions such as "act as an expert" or "think carefully" cannot replace missing data, unclear requirements, or a definition of success. The opposite mistake is equally costly: excessively long prompts can introduce contradictions, distract the model from the main task, and increase input-token cost on every single call.
Practical takeaway
Use a repeatable prompt structure — task, context, constraints, output, examples, success criteria — and test it against a small set of representative tasks rather than judging it from one successful response.
Decision check: a prompt is effective when it reliably produces a useful result without unnecessary instructions, tokens, or retries.
Compute College
Use the GPU-Hour Cost Calculator, AI Training Cost Calculator, or Model Serving Cost Calculator.
Compute College track
Step 1 of 2: What is prompt engineering