← 返回接入教程
POST

/api/proxy/search · Search 搜索

根据查询语句搜索网络内容,返回最相关的结果。Body 与 Tavily 官方 /search 一致。

请求参数
参数
类型
说明
query*
string搜索查询语句(必填)
search_depth
string搜索深度:basic | advanced | fast | ultra-fast,默认 basic。basic/fast/ultra-fast 计 1 credit,advanced 计 2 credits
chunks_per_source
integer每个来源返回的最大片段数(1-3),默认 3。仅 search_depth 为 advanced/basic/fast 时生效
max_results
integer返回结果数(0-20),默认 10
topic
string主题:general | news | finance,默认 general。news 适合实时新闻,finance 适合金融检索
time_range
string按发布日期/更新日期倒推时间窗口:day | week | month | year(或简写 d/w/m/y)
start_date
string起始日期 YYYY-MM-DD,仅返回该日期之后的结果
end_date
string结束日期 YYYY-MM-DD,仅返回该日期之前的结果
include_published_date
boolean在每条 result 中返回 published_date 字段(Beta),默认 false
filter_by_published_date
boolean剔除发布日期落在 time_range/start_date/end_date 之外的结果(同时启用 include_published_date)
include_answer
boolean | string返回 LLM 生成的回答。true/basic 简答,advanced 详细
include_raw_content
boolean | string返回清洗后的网页正文。true/markdown 返回 markdown,text 返回纯文本
include_images
boolean是否返回查询相关图片(顶层 images + 每条 result.images)
include_image_descriptions
boolean为每张图片附带描述文本(需 include_images=true)
include_favicon
boolean在每条 result 中返回 favicon URL
include_domains
array限定搜索域名(最多 300)
exclude_domains
array排除搜索域名(最多 150)
include_domains_mode
stringinclude_domains 作用方式:restrict(硬过滤,默认) | prefer(白名单优先但仍搜全网)
country
string国家偏好(英文国名小写,如 china/united states),仅 topic=general 生效
language
string结果语言偏好,ISO 639-1(如 zh-cn/en)或英文名(如 chinese/english)
filter_by_language
boolean严格按 language 过滤(剔除不匹配的结果),需同时设置 language
auto_parameters
boolean由 Tavily 根据 query 自动配置参数(可能将 search_depth 升为 advanced,额外消耗 1 credit)
exact_match
boolean强制只返回包含 query 中带引号精确短语的结果
include_usage
boolean在响应里附带 credits 用量明细(usage 字段)
safe_search
boolean过滤成人/不安全内容(不支持 fast/ultra-fast)
代码示例
cURL
Python
JavaScript
Go
curl -X POST https://tavily.sharyuke.com/api/proxy/search \
  -H "Authorization: Bearer thb-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "query": "最新的人工智能研究进展", "max_results": 5, "search_depth": "advanced", "topic": "general", "include_answer": true, "include_raw_content": false }'
响应示例
{ "code": 0, "message": "ok", "data": { "ok": true, "data": { "query": "最新的人工智能研究进展", "answer": "人工智能研究在 2025 年持续聚焦多模态与 Agent...", "images": [], "results": [{ "title": "Example Result", "url": "https://example.com/article", "content": "...", "score": 0.95, "raw_content": null, "published_date": null, "favicon": null, "images": [], "id": "a3f9c2-04" }], "auto_parameters": null, "response_time": 1.67, "request_id": "123e4567-e89b-12d3-a456-426614174111" }, "usage": { "credits": 1 } } }
错误码
错误码
含义
处理建议
400请求参数错误检查请求体字段
401API Key 无效检查 Authorization 头
429超过速率限制降低请求频率
500内部错误稍后重试或联系支持
503上游服务不可用网关已自动重试,请稍候

准备好接入了吗?

邮箱注册即可免费使用,每月 3,600 次免费调用,无需信用卡。