网页搜索: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
此页面对您有帮助吗?