GPT-5 is OpenAI’s newest flagship model, representing a substantial leap forward in agentic task performance, coding, raw intelligence, and steerability. While it performs strongly out of the box, getting the most from GPT-5 — especially in production — requires understanding how the model differs from its predecessors and how to tune prompts accordingly.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openai/openai-cookbook/llms.txt
Use this file to discover all available pages before exploring further.
What’s new in GPT-5
GPT-5 introduces several capabilities and API parameters that did not exist in GPT-4o or GPT-4.1:Reasoning effort
A
reasoning_effort parameter (low, medium, high) controls how deeply the model thinks before responding. Higher effort improves accuracy on complex tasks; lower effort reduces latency and cost.Verbosity control
A new
verbosity parameter influences the length of the model’s final answer independently of its thinking depth. Useful when you want terse status updates but verbose code output.Responses API
GPT-5 integrates with the Responses API, which persists reasoning across tool calls. This unlocks more efficient and intelligent agentic flows compared to Chat Completions.
Agentic eagerness
GPT-5 is trained to be thorough when gathering context in agentic settings. Its proactivity is configurable via prompt and
reasoning_effort.Making your first GPT-5 API call
The API surface is the same as earlier models. Start withgpt-4o as the model ID in existing code and swap it for gpt-5 when you are ready to adopt the new model:
Writing effective system prompts
GPT-5 follows instructions with high precision — which is a strength, but also means that vague or contradictory prompts have more impact than with earlier models. A prompt that seemed to work well enough with GPT-4o may produce inconsistent or unexpected behavior with GPT-5 because the model takes every instruction literally.Resolve contradictions before they reach the model
The following system prompt contains two contradictions that impair GPT-5 performance:Structure with XML tags
GPT-5 responds well to prompts that use XML-style tags to separate distinct categories of instruction:Controlling reasoning effort
Usereasoning_effort to trade latency for accuracy. The default is medium.
When to use high reasoning effort
When to use high reasoning effort
Complex multi-step coding tasks, long-context analysis, agentic workflows with ambiguous goals, and tasks where correctness matters more than speed.
When to use medium reasoning effort
When to use medium reasoning effort
The default. Suitable for most production tasks including question answering, summarization, and structured output generation.
When to use low (minimal) reasoning effort
When to use low (minimal) reasoning effort
Latency-sensitive tasks, simple transformations, current users upgrading from GPT-4.1 who need similar speed characteristics. At minimal reasoning, use more explicit prompts — include planning instructions and persistence reminders that the model would otherwise handle internally.
Controlling agentic eagerness
GPT-5 is trained to be thorough in agentic contexts. You can steer how proactive it is. Reduce eagerness (faster, fewer tool calls):Using the Responses API for agentic tasks
For multi-turn agentic workflows, switch from Chat Completions to the Responses API. Reasoning is persisted between tool calls, improving both accuracy and efficiency:previous_response_id has produced statistically significant accuracy improvements in internal evaluations (e.g., Tau-Bench Retail scores from 73.9% to 78.2%).
Migrating from GPT-4o or GPT-4.1
GPT-5 follows instructions more literally and precisely than earlier models. Prompts that worked with GPT-4o by relying on the model to “infer intent” may need to be made more explicit.Audit for ambiguous instructions
Phrases like “do not include irrelevant information” are interpreted loosely by GPT-4o but may cause GPT-5 to omit details you want kept. Replace them with specific criteria: “Only include facts directly related to topic X. Exclude personal anecdotes and historical context.”
Remove contradictions
Review your prompt for instructions that conflict. GPT-5 expends reasoning tokens trying to reconcile them rather than picking one at random.
Add explicit stop and escalation conditions
For agentic prompts, state clearly when the model should stop, when it should ask the user, and when it should proceed under uncertainty.
Use reasoning effort to match previous latency
If GPT-4o speed was a requirement, start with
reasoning_effort="low" on GPT-5 and increase only where accuracy requires it.Verbosity and formatting
By default, GPT-5 in the API does not format output in Markdown. To enable it:If Markdown adherence degrades over a long conversation, appending a formatting reminder every three to five user messages reliably restores it.