Skip to main content
Specialized Models

Qwen-Deep-Research API reference

Input and output parameters for the Qwen-Deep-Research deep research model.

POST
/api/v1/services/aigc/text-generation/generation
import os
import dashscope

# China North 2 (Beijing). This model is available only in this region.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
dashscope.base_http_api_url = "https://cn-beijing.maas.qwencloudapi.com/api/v1"

# Step 1: ask the model to clarify the research scope.
messages = [{'role': 'user', 'content': 'Research how artificial intelligence is used in education.'}]

responses = dashscope.Generation.call(
  api_key=os.getenv('DASHSCOPE_API_KEY'),
  model='qwen-deep-research',
  messages=messages,
  stream=True
)

# Collect the clarifying question.
step1_content = ''
for response in responses:
  if hasattr(response, 'output') and response.output:
    message = response.output.get('message', {})
    content = message.get('content', '')
    if content:
      step1_content += content
      print(content, end='', flush=True)

# Step 2: run the deep research with the full conversation.
messages = [
  {'role': 'user', 'content': 'Research how artificial intelligence is used in education.'},
  {'role': 'assistant', 'content': step1_content},
  {'role': 'user', 'content': 'I care mainly about personalized learning and automated assessment.'}
]

responses = dashscope.Generation.call(
  api_key=os.getenv('DASHSCOPE_API_KEY'),
  model='qwen-deep-research',
  messages=messages,
  stream=True
)

for response in responses:
  if hasattr(response, 'output') and response.output:
    message = response.output.get('message', {})
    content = message.get('content', '')
    if content:
      print(content, end='', flush=True)
{
  "status_code": 200,
  "request_id": "2a6187f0-7e7b-40bb-a87e-xxx",
  "code": "",
  "message": "",
  "output": {
    "text": null,
    "finish_reason": null,
    "choices": null,
    "message": {
      "phase": "answer",
      "role": "assistant",
      "content": "Based on the research, AI in education is mainly used in the following areas...",
      "extra": {
        "deep_research": {
          "references": [
            {
              "icon": "",
              "index_number": 1,
              "description": "Research on AI for personalized learning",
              "title": "AI and the transformation of education",
              "url": "https://example.com/ai-education"
            }
          ]
        }
      },
      "status": "typing"
    },
    "fininshed": false,
    "fininshed_reason": "null"
  },
  "usage": {
    "input_tokens": 694,
    "output_tokens": 128
  }
}
  • Supported regions: China North 2 (Beijing) only. Use an API key created in that region and https://cn-beijing.maas.qwencloudapi.com.
  • The model supports only the DashScope Python SDK and the HTTP API. The Java SDK and the OpenAI compatible interface are not supported.
  • To stream the response over HTTP, add the X-DashScope-SSE: enable request header.

Call flow

Qwen-Deep-Research uses a two-step workflow:
  1. Follow-up question: Send the research topic. The model returns a clarifying question that helps narrow the scope.
  2. Deep research: Send the original question, the model's follow-up question, and your answer as a multi-turn conversation. The model runs deep research and generates a report.
Set parameters.enable_feedback to false to skip the first step and start research directly.

Streaming phases

After you enable streaming with the X-DashScope-SSE: enable request header, the response arrives in the following phases:
{
  "output": {
    "message": {
      "phase": "ResearchPlanning",
      "role": "assistant",
      "content": "",
      "extra": { "deep_research": {} },
      "status": "typing"
    },
    "fininshed": false,
    "fininshed_reason": "null"
  },
  "usage": { "input_tokens": 694, "output_tokens": 0 }
}
The fininshed and fininshed_reason field names are spelled this way in the API response. Match the spelling exactly when you parse the response. For a usage example and guidance on when to use this model, see the guide.

Authorizations

string
header
required

QwenCloud API key. See Get an API key.

Body

application/json
enum<string>
required

Model name.

qwen-deep-research
object
required

Input information.

enum<string>
default"model_detailed_report"

Format and level of detail of the research report.

  • model_detailed_report (default): A complete, detailed deep research report of about 6,000 tokens.
  • model_summary_report: A concise summary report of about 1,500-2,000 tokens that highlights the key findings.
model_detailed_report,model_summary_report
object

Model call parameters.

Response

200-application/json
integer

Request status code. 200 means success; any other value means failure. A failed call throws an exception whose message contains status_code and message.

string

Unique identifier of this call.

string

Error code. Empty when the call succeeds. Returned only by the Python SDK.

string

Error message. Empty when the call succeeds.

object

Result information.

object

Token usage for this request.