> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 联网搜索增强

> 开启联网搜索，让模型参考实时信息。

传 `tools: [{"type": "web_search"}]` 开启联网搜索，适合涉及时事、热点或最新资料的内容。目前只支持 `web_search` 一种工具。

> [!TIP]
>
> 想直接调试？打开 [创建视频生成任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/create-task.md)，在请求示例下拉框中选择「联网搜索增强」，填入 API Key 后点击 **Try it**。

## 请求示例

示例中的 `$DREAMTO_API_KEY` 为你的 API Key。

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/api/v3/contents/generations/tasks" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.5-flash",
    "content": [
      {
        "type": "text",
        "text": "制作一段介绍当下最热门旅游目的地的短视频"
      }
    ],
    "ratio": "16:9",
    "duration": 5,
    "resolution": "720p",
    "tools": [
      {
        "type": "web_search"
      }
    ]
  }'
```

```python Python theme={null}
import os
import requests

payload = {
    "model": "seedance-2.5-flash",
    "content": [
        {
            "type": "text",
            "text": "制作一段介绍当下最热门旅游目的地的短视频"
        }
    ],
    "ratio": "16:9",
    "duration": 5,
    "resolution": "720p",
    "tools": [
        {
            "type": "web_search"
        }
    ]
}

resp = requests.post(
    "https://api.dreamto.ai/api/v3/contents/generations/tasks",
    headers={"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"},
    json=payload,
    timeout=60,
)
print(resp.status_code, resp.json())  # {'id': 'task_...', 'request_id': 'req_...'}
```

```javascript Node.js theme={null}
const payload = {
  "model": "seedance-2.5-flash",
  "content": [
    {
      "type": "text",
      "text": "制作一段介绍当下最热门旅游目的地的短视频"
    }
  ],
  "ratio": "16:9",
  "duration": 5,
  "resolution": "720p",
  "tools": [
    {
      "type": "web_search"
    }
  ]
};

const resp = await fetch("https://api.dreamto.ai/api/v3/contents/generations/tasks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DREAMTO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log(resp.status, await resp.json()); // { id: 'task_...', request_id: 'req_...' }
```

## 响应

创建成功返回 HTTP 200。`request_id` 与响应头 `X-Request-Id` 相同，排查问题时请提供：

```json theme={null}
{
  "id": "task_8c1d2e3f4a5b6c7d8e9f0a1b",
  "request_id": "req_3f9a1c2b7d4e5f60718293a4"
}
```

拿到任务 `id` 后，调用 [查询任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/get-task.md) 轮询结果，`status` 为 `succeeded` 时读取 `content.video_url`。全部请求参数与取值说明见 [创建视频生成任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/create-task.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.