跳转至

MaaS_DB_webSearch

请求协议

https

参数名 类型 必填 描述
Content-Type string 是 application/json
Authorization string 是 Bearer ${your_ak}

请求 Body 参数

参数名 二级参数 三级参数 类型 必填 描述
model - - string 是 Doubao Seed 模型 ID / Endpoint ID
input - - string 或 array 是 用户输入;可为字符串,或消息数组
role - string 是(array 时) system / user / assistant
content - string 或 array 是(array 时) 文本或多模态内容
- type string 否 多模态时为 input_text 等
- text string 否 type=input_text 时的文本
tools - - array[object] 否 可用工具列表;启用联网时包含 web_search
type - string 是 固定为 web_search
sources - array[string] 否 内容源列表:search_engine、toutiao、douyin、moji;未指定时由模型/平台默认策略决定
max_keyword - integer 否 单次搜索轮次内,模型可发起的最大关键词数量
limit - integer 否 单轮搜索每个关键词的最大返回条数;取值 [1, 50],默认 10
user_location - object 否 近似用户地理位置,用于优化本地/天气类检索
- type string 否 位置类型,如 approximate
- city string 否 城市
- country string 否 国家
- region string 否 省/地区

请求示例

curl --location 'https://genaiapi.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/responses' \
  --header 'Authorization: Bearer ${your_ak}' \
  --header 'Content-Type: application/json' \
  --data '{
    "tools": [
      {
        "type": "web_search",
        "max_keyword": 3,
        "limit": 20,
        "sources": ["search_engine", "toutiao"]
      }
    ],
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "2026年工厂VI形象设计公司有哪些推荐?"
          }
        ]
      }
    ]
  }'

响应示例

响应中通常包含两类关键输出项:

  "usage": {
    "input_tokens": 1200,
    "output_tokens": 800,
    "total_tokens": 2000,
    "tool_usage": {
      "web_search": 2
    },
    "tool_usage_details": {
      "web_search": {
        "search_engine": 2,
        "toutiao": 2
      }
    }
  }

usage 字段说明:

字段 说明
tool_usage.web_search 本轮 web_search 工具调用总次数(关键词维度)
tool_usage_details.web_search.{source} 按内容源拆分的检索次数,如 search_engine、toutiao