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>",
"intent": "SEARCH_ALL",
"keywords": "<string>"
}
],
"search_result": [
{
"title": "<string>",
"content": "<string>",
"link": "<string>",
"media": "<string>",
"icon": "<string>",
"refer": "<string>",
"publish_date": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}网络搜索
Web Search API 是一个专给大模型用的搜索引擎,在传统搜索引擎网页读取、排序的能力基础上,增强了意图识别能力,返回更适合大模型处理的结果(网页标题、URL、摘要、名称、图标等)。支持意图增强检索、结构化输出和多引擎支持。见 网络搜索服务。点击 Try it 按钮可快速试用。
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>",
"intent": "SEARCH_ALL",
"keywords": "<string>"
}
],
"search_result": [
{
"title": "<string>",
"content": "<string>",
"link": "<string>",
"media": "<string>",
"icon": "<string>",
"refer": "<string>",
"publish_date": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Body
需要进行搜索的内容,建议搜索 query 不超过 70 个字符。
70要调用的搜索引擎编码。目前支持:
search_std:智谱基础版搜索引擎
search_pro:智谱高阶版搜索引擎
search_pro_sogou:搜狗
search_pro_quark:夸克搜索
search_std, search_pro, search_pro_sogou, search_pro_quark "search_std"
是否进行搜索意图识别,默认不执行搜索意图识别。
true:执行搜索意图识别,有搜索意图后执行搜索
false:跳过搜索意图识别,直接执行搜索
返回结果的条数。可填范围:1-50,最大单次搜索返回50条,默认为10。
支持的搜索引擎:search_pro_sogou、search_std、search_pro
search_pro_sogou: 可选枚举值,10、20、30、40、50。注意同时指定 search_domain_filter 和 search_recency_filter 时 count 不生效。
1 <= x <= 50用于限定搜索结果的范围,仅返回指定白名单域名的内容。
白名单域名:(如 www.example.com)
支持的搜索引擎:search_std、search_pro 、search_pro_sogou
搜索指定时间范围内的网页。默认为 noLimit。可填值:oneDay(一天内)、oneWeek(一周内)、oneMonth(一个月内)、oneYear(一年内)、noLimit(不限,默认)。支持的搜索引擎:search_std、search_pro、search_pro_Sogou、search_pro_quark
oneDay, oneWeek, oneMonth, oneYear, noLimit 控制返回网页内容的长短。medium:返回摘要信息,满足大模型的基础推理需求,满足常规问答任务的信息检索需求。high:最大化上下文,信息量较大但内容详细,适合需要信息细节的场景。支持的搜索引擎:search_std、search_pro、search_pro_Sogou、search_pro_quark
medium, high 请求唯一标识符。由用户端传递,ID长度要求:最少6个字符,最多64个字符,建议使用UUID格式确保唯一性,若未提供平台将自动生成。
6 - 64终端用户的唯一ID,帮助平台对终端用户的非法活动、生成非法不当信息或其他滥用行为进行干预。ID长度要求:至少6个字符,最多128个字符。
6 - 128Was this page helpful?