网页搜索:deepseek-search
curl --request POST \
--url https://api.apiyi.com/v1/tools/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "DeepSeek V4 发布"
}
'import requests
url = "https://api.apiyi.com/v1/tools/search"
payload = { "query": "DeepSeek V4 发布" }
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({query: 'DeepSeek V4 发布'})
};
fetch('https://api.apiyi.com/v1/tools/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/tools/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([
'query' => 'DeepSeek V4 发布'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/tools/search"
payload := strings.NewReader("{\n \"query\": \"DeepSeek V4 发布\"\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))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/tools/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"DeepSeek V4 发布\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/tools/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"DeepSeek V4 发布\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"title": "DeepSeek V4 正式发布",
"url": "https://example.com/news/deepseek-v4",
"snippet": "约 100–200 字的短摘要……",
"summary": "约 600–800 字的长摘要……",
"content": "",
"rerank_score": 2.1,
"authority": 3,
"date": "2026-10-20T08:00:00Z",
"site_name": "Example News",
"site_icon": "https://example.com/favicon.ico"
}
]
}DeepSeek Search & Fetch
DeepSeek 網頁搜尋 API 參考
DeepSeek Search API 參考與線上除錯:/v1/tools/search 端點引數說明、搜尋語法、響應結構與錯誤碼對照。
POST
/
v1
/
tools
/
search
网页搜索:deepseek-search
curl --request POST \
--url https://api.apiyi.com/v1/tools/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "DeepSeek V4 发布"
}
'import requests
url = "https://api.apiyi.com/v1/tools/search"
payload = { "query": "DeepSeek V4 发布" }
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({query: 'DeepSeek V4 发布'})
};
fetch('https://api.apiyi.com/v1/tools/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/tools/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([
'query' => 'DeepSeek V4 发布'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/tools/search"
payload := strings.NewReader("{\n \"query\": \"DeepSeek V4 发布\"\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))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/tools/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"DeepSeek V4 发布\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/tools/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"DeepSeek V4 发布\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"title": "DeepSeek V4 正式发布",
"url": "https://example.com/news/deepseek-v4",
"snippet": "约 100–200 字的短摘要……",
"summary": "约 600–800 字的长摘要……",
"content": "",
"rerank_score": 2.1,
"authority": 3,
"date": "2026-10-20T08:00:00Z",
"site_name": "Example News",
"site_icon": "https://example.com/favicon.ico"
}
]
}右側 Playground 可直接除錯:在 Authorization 填
Bearer sk-your-api-key(default 或 svip 分組的令牌),
預設示例已填好,點擊發送即可看到搜尋結果。每次成功呼叫扣費一次。
localization 要填使用者的 IP 地址(如 8.8.8.8),填 zh-CN 這類語言程式碼會返回 400。定價、實測資料與必須知道的幾件事見 概覽。
引數說明速查
| 引數 | 型別 | 必填 | 說明 |
|---|---|---|---|
query | string | ✓ | 1–128 個字元,不能全是空白。支援 site:、-site:、"..."、lang:、after:、before: 等語法 |
count | int | 1–50,預設 10。不影響價格 | |
need_content | bool | 預設 false;true 時每條結果附帶網頁正文 | |
ori_question | string | 使用者原始問題,1–128 個字元 | |
localization | string | 使用者 IP 地址(不是語言程式碼),用於本地化排序 |
model 欄位;未識別的欄位會被忽略。
響應要點
{
"results": [
{
"title": "...",
"url": "https://...",
"snippet": "約 100–200 字的短摘要",
"summary": "約 600–800 字的長摘要",
"content": "",
"rerank_score": 2.1,
"authority": 3,
"date": "2026-10-20T08:00:00Z",
"site_name": "...",
"site_icon": "https://..."
}
]
}
- 給模型用
summary,給人看用snippet;全文要麼開need_content,要麼挑幾條用 Fetch 抓 rerank_score≥ 1.5、authority≥ 3 可視為高品質結果,適合做過濾閾值count=50時響應體約 180KB,開need_content會再大一倍以上,注意客戶端超時設定
錯誤碼對照
| HTTP | 錯誤資訊示例 | 原因與處理 | 扣費 |
|---|---|---|---|
| 400 | 'count' must be between 1 and 50 | count 超範圍 | 否 |
| 400 | 'query' must not be empty / missing field 'query' | 缺 query 或為空 | 否 |
| 400 | 'localization' must be a valid IP address | localization 傳了語言程式碼,改傳 IP 或去掉 | 否 |
| 401 | Invalid token. | API Key 無效或未帶 Authorization 頭 | 否 |
| 429 | — | 超出上游限流(100 QPS),等待後重試 | 否 |
| 503 | no available channels for model deepseek-search | 令牌所在分組沒有開通本介面(如 ClaudeCode 分組),換 default / svip 令牌 | 否 |
| 5xx / 504 | — | 上游內部錯誤或超時,稍後重試 | 否 |
type 統一為 shell_api_error,請以 HTTP 狀態碼判斷錯誤種類。授權
在请求头中添加 Authorization: Bearer YOUR_API_KEY
主體
application/json
搜索词,1–128 个字符,不能全是空白。支持 site: / lang: / after: 等搜索语法
範例:
"DeepSeek V4 发布"
返回条数,1–50。不影响价格
必填範圍:
1 <= x <= 50範例:
5
是否返回网页正文。为 false 时 content 恒为空字符串
触发这次搜索的用户原始问题,1–128 个字符
用户的 IP 地址,用于优先返回本地化结果。不是语言代码,传 ja-JP 会返回 400
範例:
"8.8.8.8"
回應
搜索成功(计费一次)
Show child attributes
Show child attributes
這個頁面有幫助嗎?