In the age of information overload, the ability to conduct fast, accurate, and comprehensive research is a superpower. Developers, analysts, and strategists spend countless hours sifting through documents, verifying sources, and synthesizing findings. What if you could automate this entire workflow? OpenAI's Deep Research API is a significant step in that direction, offering a powerful tool to transform high-level questions into structured, citation-rich reports.
The Deep Research API isn't just another large language model. It's an agentic system designed to tackle complex research tasks. It can autonomously decompose a query, perform web searches, execute code to analyze data, and synthesize the results into a coherent, verifiable report. It's built for depth, nuance, and trust, providing not just answers, but also the evidence behind them.
This guide will provide a developer-focused walkthrough of the Deep Research API. We'll cover everything from making your first API call to advanced prompting techniques. We'll primarily focus on two models available through the API:
o3-deep-research-2025-06-26
: The flagship model, optimized for the highest quality synthesis and in-depth analysis.o4-mini-deep-research-2025-06-26
: A lighter, faster model perfect for latency-sensitive applications.
By the end of this article, you'll have a solid understanding of how to integrate this powerful research agent into your own applications.
Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!
OpenAI Deep Research API Pricing, Rate Limits

Choosing the right model and understanding the costs are crucial for production applications.
Choosing Your Model
o3-deep-research
: This is your go-to for complex tasks requiring the highest level of reasoning and synthesis. It's slower but delivers superior quality.o4-mini-deep-research
: Use this model when speed is a priority. It's ideal for more straightforward research tasks or interactive applications where low latency is key.
Understanding the Costs
As of late 2024, the pricing for the powerful o3-deep-research
model is token-based:
- Input: $10.00 per 1 million tokens
- Output: $40.00 per 1 million tokens
The higher cost for output tokens reflects the intensive synthesis and generation work the model performs.
Key Specifications (o3-deep-research
)
- Context Window: A massive 200,000 tokens.
- Max Output Tokens: A generous 100,000 tokens, allowing for very long-form reports.
- Knowledge Cutoff: Jun 01, 2024. The model's internal knowledge is current up to this date, but the
web_search_preview
tool gives it access to real-time information.
Make Your First OpenAI Deep Research API Call
Let's dive right in. Before you can use the API, you'll need the OpenAI Python SDK.
Setup
If you haven't already, install the latest version of the library:
pip install --upgrade openai
Next, you'll need to authenticate. Import the OpenAI
client and initialize it with your API key.
from openai import OpenAI
import os
# It's best practice to use an environment variable for your API key
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
Making the Request
A Deep Research task can take several minutes to complete, especially for complex queries. To avoid timeouts, it's highly recommended to run requests in the background. The API makes this easy.
Let's imagine we're building a tool for a healthcare financial services firm. The task is to produce a report on the economic impact of new diabetes and obesity medications. Here’s how you would structure that request:
system_message = """
You are a professional researcher preparing a structured, data-driven report on behalf of a global health economics team. Your task is to analyze the health question the user poses.
Do:
- Focus on data-rich insights: include specific figures, trends, statistics, and measurable outcomes.
- When appropriate, summarize data in a way that could be turned into charts or tables.
- Prioritize reliable, up-to-date sources: peer-reviewed research, health organizations (e.g., WHO, CDC), etc.
- Include inline citations and return all source metadata.
Be analytical, avoid generalities, and ensure that each section supports data-backed reasoning.
"""
user_query = "Research the economic impact of semaglutide on global healthcare systems."
response = client.responses.create(
model="o3-deep-research", # Or "o3-deep-research-2025-06-26"
input=[
{
"role": "developer",
"content": [
{
"type": "input_text",
"text": system_message,
}
]
},
{
"role": "user",
"content": [
{
"type": "input_text",
"text": user_query,
}
]
}
],
reasoning={
"summary": "auto"
},
tools=[
{
"type": "web_search_preview"
},
{
"type": "code_interpreter"
}
]
)
Let's break down this call:
model
: We specifyo3-deep-research
for a high-quality report.input
: This is where we provide our prompts. Thesystem_message
sets the persona and overall goal for the agent. Theuser_query
is the specific research task.reasoning
: Settingsummary
to"auto"
allows the model to generate the best possible summary for the report. For more detailed reports, you can set this to"detailed"
.tools
: This array tells the agent what tools it has at its disposal.web_search_preview
is required for it to browse the web.code_interpreter
is optional but allows the agent to run Python code for data analysis and visualization.
The true power of the Deep Research API lies in the structured, detailed response object it returns. It's more than just a block of text; it's a transparent record of the research process.
The Final Report
The main output is, of course, the final report. You can access it from the last item in the output
array:
# Access the final report from the response object
print(response.output[-1].content[0].text)
This will give you the complete, synthesized text generated by the model.
Citations and Sources
One of the most critical features for any serious research is citation. The Deep Research API embeds citation metadata directly into the response. Each citation is linked to a specific part of the text, allowing for easy verification.
Here's how you can extract and display the citations:
annotations = response.output[-1].content[0].annotations
for i, citation in enumerate(annotations):
print(f"Citation {i+1}:")
print(f" Title: {citation.title}")
print(f" URL: {citation.url}")
print(f" Location: chars {citation.start_index}–{citation.end_index}")
This structure is invaluable for building applications that require high degrees of trust and transparency. You can use it to create clickable footnotes, build a bibliography, or programmatically trace claims back to their original source.
Peeking Under the Hood: Intermediate Steps
The API also exposes the agent's entire thought process. The response.output
contains a log of all intermediate steps taken to arrive at the final answer. This is incredibly useful for debugging, analysis, or simply understanding how the agent works.
- Reasoning Steps: These represent the model's internal plans and summaries as it breaks down the problem.
reasoning = next(item for item in response.output if item.type == "reasoning")
for s in reasoning.summary:
print(s.text)
- Web Search Calls: You can see the exact search queries the agent used.
search = next(item for item in response.output if item.type == "web_search_call")
print("Query:", search.action["query"])
- Code Execution: If the
code_interpreter
tool was used, you can inspect the code it ran and the resulting output.
code_step = next((item for item in response.output if item.type == "code_interpreter_call"), None)
if code_step:
print("Code Input:", code_step.input)
print("Code Output:", code_step.output)
Using OpenAI Deep Research with MCP Servers
Advanced Research with MCP Servers
While web search gives the Deep Research agent access to a vast repository of public information, its true power is unlocked when you connect it to your own private data.
This is where the Model Context Protocol (MCP) comes in. MCP allows you to build custom tools that extend the agent's capabilities, enabling it to query your internal knowledge bases, databases, or other proprietary services.
One of the popular MCP Server currently is Apidog MCP Server, which allows you to connect to your API Documentation within Cursor and other AI Coding tools, and greatly reduces AI hallucination by pulling from the factual API Specs.
Conclusion: The Future of Automated Research
The OpenAI Deep Research API is more than just an incremental improvement. It represents a fundamental shift in how we can leverage AI for knowledge work. By providing an agent that can reason, plan, execute tools, and produce verifiable results, OpenAI has created a building block for a new generation of research applications.
Whether you're building competitive intelligence dashboards, automating literature reviews, or creating sophisticated market analysis reports, the Deep Research API provides the power, transparency, and trust required for serious, real-world use cases. As the cookbook hints, the next step is likely fully-fledged "Deep Research Agents," suggesting an even more autonomous and capable future. For now, the API gives developers an incredible new tool to explore. Start building with it today.