Skip to main content
POST
/
paas
/
v4
/
web_search
网络搜索
curl --request POST \
  --url https://open.bigmodel.cn/api/paas/v4/web_search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "search_query": "<string>",
  "search_engine": "search_std",
  "search_intent": false,
  "count": 10,
  "search_domain_filter": "<string>",
  "search_recency_filter": "noLimit",
  "request_id": "<string>",
  "user_id": "<string>"
}
'
import requests

url = "https://open.bigmodel.cn/api/paas/v4/web_search"

payload = {
"search_query": "<string>",
"search_engine": "search_std",
"search_intent": False,
"count": 10,
"search_domain_filter": "<string>",
"search_recency_filter": "noLimit",
"request_id": "<string>",
"user_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
search_query: '<string>',
search_engine: 'search_std',
search_intent: false,
count: 10,
search_domain_filter: '<string>',
search_recency_filter: 'noLimit',
request_id: '<string>',
user_id: '<string>'
})
};

fetch('https://open.bigmodel.cn/api/paas/v4/web_search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/web_search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"search_query\": \"<string>\",\n \"search_engine\": \"search_std\",\n \"search_intent\": false,\n \"count\": 10,\n \"search_domain_filter\": \"<string>\",\n \"search_recency_filter\": \"noLimit\",\n \"request_id\": \"<string>\",\n \"user_id\": \"<string>\"\n}")
.asString();
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://open.bigmodel.cn/api/paas/v4/web_search"

payload := strings.NewReader("{\n \"search_query\": \"<string>\",\n \"search_engine\": \"search_std\",\n \"search_intent\": false,\n \"count\": 10,\n \"search_domain_filter\": \"<string>\",\n \"search_recency_filter\": \"noLimit\",\n \"request_id\": \"<string>\",\n \"user_id\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/web_search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'search_query' => '<string>',
'search_engine' => 'search_std',
'search_intent' => false,
'count' => 10,
'search_domain_filter' => '<string>',
'search_recency_filter' => 'noLimit',
'request_id' => '<string>',
'user_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "id": "<string>",
  "created": 123,
  "request_id": "<string>",
  "search_intent": [
    {
      "query": "<string>",
      "keywords": "<string>"
    }
  ],
  "search_result": [
    {
      "title": "<string>",
      "content": "<string>",
      "link": "<string>",
      "media": "<string>",
      "icon": "<string>",
      "refer": "<string>",
      "publish_date": "<string>"
    }
  ]
}
{
"error": {
"code": "<string>",
"message": "<string>"
}
}

Authorizations

Authorization
string
header
required

标准的 HTTP Bearer 认证方式,在 API Keys 页面获取密钥。

Body

application/json
search_query
string
required

需要进行搜索的内容,建议搜索 query 不超过 70 个字符。

Maximum string length: 70
search_engine
enum<string>
required

要调用的搜索引擎编码。目前支持: search_std:智谱基础版搜索引擎 search_pro:智谱高阶版搜索引擎 search_pro_sogou:搜狗 search_pro_quark:夸克搜索

Available options:
search_std,
search_pro,
search_pro_sogou,
search_pro_quark
Example:

"search_std"

search_intent
boolean
default:false
required

是否进行搜索意图识别,默认不执行搜索意图识别。 true:执行搜索意图识别,有搜索意图后执行搜索 false:跳过搜索意图识别,直接执行搜索

count
integer
default:10

返回结果的条数。可填范围:1-50,最大单次搜索返回50条,默认为10。 支持的搜索引擎:search_pro_sogousearch_stdsearch_pro search_pro_sogou: 可选枚举值,10、20、30、40、50。注意同时指定 search_domain_filter 和 search_recency_filter 时 count 不生效。

Required range: 1 <= x <= 50
search_domain_filter
string

用于限定搜索结果的范围,仅返回指定白名单域名的内容。 白名单域名:(如 www.example.com) 支持的搜索引擎:search_std、search_pro 、search_pro_sogou

search_recency_filter
enum<string>
default:noLimit

搜索指定时间范围内的网页。默认为 noLimit。可填值:oneDay(一天内)、oneWeek(一周内)、oneMonth(一个月内)、oneYear(一年内)、noLimit(不限,默认)。支持的搜索引擎:search_std、search_pro、search_pro_Sogou、search_pro_quark

Available options:
oneDay,
oneWeek,
oneMonth,
oneYear,
noLimit
content_size
enum<string>

控制返回网页内容的长短。medium:返回摘要信息,满足大模型的基础推理需求,满足常规问答任务的信息检索需求。high:最大化上下文,信息量较大但内容详细,适合需要信息细节的场景。支持的搜索引擎:search_std、search_pro、search_pro_Sogou、search_pro_quark

Available options:
medium,
high
request_id
string

请求唯一标识符。由用户端传递,ID长度要求:最少6个字符,最多64个字符,建议使用UUID格式确保唯一性,若未提供平台将自动生成。

Required string length: 6 - 64
user_id
string

终端用户的唯一ID,帮助平台对终端用户的非法活动、生成非法不当信息或其他滥用行为进行干预。ID长度要求:至少6个字符,最多128个字符。

Required string length: 6 - 128

Response

业务处理成功

id
string

任务 ID

created
integer

请求创建时间,是以秒为单位的 Unix 时间戳

request_id
string

请求标识符

search_intent
object[]

搜索意图结果

search_result
object[]

搜索结果