网页搜索: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 欄位;未識別的欄位會被忽略。
傳送前檢查 query 長度,包含 site: 等運算子的完整搜尋詞也必須在 128 個字元以內。超長時請縮短關鍵詞或拆分查詢,不要原樣重試;ori_question 同樣不能超過 128 個字元。
響應要點
{
"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 抓取 - 搜尋返回連結或
content,不保證後續 Fetch 同一連結成功。優先利用已有content並檢查是否完整;只有摘要時應明確標註為摘要,需要更多內容可換用其他可訪問的原文或摘要頁 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 | 'query' must be at most 128 characters | 搜尋詞超長,縮短關鍵詞或拆分查詢後再試 | 否 |
| 400 | 'localization' must be a valid IP address | localization 傳了語言程式碼,改傳 IP 或去掉 | 否 |
| 401 | Invalid token. | API Key 無效或未帶 Authorization 頭 | 否 |
| 429 | — | 超出上游限流(100 QPS),等待後有限次數重試,逐次延長間隔 | 否 |
| 500 | Internal Server Error | 上游內部錯誤,等待後有限次數重試,逐次延長間隔 | 否 |
| 503 | no available channels for model deepseek-search | 檢查令牌分組及介面是否可用;ClaudeCode 分組需換 default / svip 令牌 | 否 |
| 504 | Request timeout | 上游超時,等待後有限次數重試;持續失敗時保留錯誤資訊並反饋 | 否 |
shell_api_error 不能單獨區分原因,請結合 HTTP 狀態碼與原始 message 判斷。503 若明確提示 no available channels,應先檢查令牌分組及介面是否開通。
部分失敗請求可能不顯示在控制台計費日誌中。排障時請保留發生時間及其時區、完整搜尋詞、介面路徑、HTTP 狀態、錯誤正文和請求 ID(如有),不要附帶 API Key 或 Authorization 請求頭。更多說明見 概覽。主體
application/json
這個頁面有幫助嗎?