深度搜索
curl --request GET \
--url https://api.pipellm.ai/v1/websearch/search \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pipellm.ai/v1/websearch/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pipellm.ai/v1/websearch/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pipellm.ai/v1/websearch/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}深度搜索
带内容提取和重排序的深度网络搜索。
GET
/
v1
/
websearch
/
search
深度搜索
curl --request GET \
--url https://api.pipellm.ai/v1/websearch/search \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pipellm.ai/v1/websearch/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pipellm.ai/v1/websearch/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pipellm.ai/v1/websearch/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}PipeLLM 通过公共网关暴露 WebSearch。适合直接在应用、后端或 Agent 工作流里获取网络
搜索结果,而不需要安装 npm 插件。
PipeLLM 会根据这条路由自动写入
Endpoint
| 方法 | 端点 |
|---|---|
GET | https://api.pipellm.ai/v1/websearch/search |
认证
Authorization: Bearer $PIPELLM_API_KEY
查询参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 是 | 搜索关键词 |
这条路由会做什么
/v1/websearch/search 是完整检索链路。它会先拿搜索结果,再抽取页面内容,随后做向量
相似度检索和重排序,并在有内容可用时返回上下文。
请求示例
- cURL
- Python
- Node.js
curl -X GET "https://api.pipellm.ai/v1/websearch/search?q=最新AI新闻" \
-H "Authorization: Bearer $PIPELLM_API_KEY"
import os
import requests
response = requests.get(
"https://api.pipellm.ai/v1/websearch/search",
params={"q": "最新 AI 新闻"},
headers={"Authorization": f"Bearer {os.getenv('PIPELLM_API_KEY')}"},
)
data = response.json()
for result in data.get("data", {}).get("organic", []):
print(f"- {result['title']}: {result['link']}")
const response = await fetch(
"https://api.pipellm.ai/v1/websearch/search?q=最新AI新闻",
{
headers: {
Authorization: `Bearer ${process.env.PIPELLM_API_KEY}`,
},
}
);
const data = await response.json();
data.data.organic.forEach((result) => {
console.log(`- ${result.title}: ${result.link}`);
});
响应格式
{
"code": 200,
"message": "ok",
"took_ms": 6050,
"data": {
"organic": [
{
"title": "AI News | Latest News | Insights Powering AI-Driven Business ...",
"link": "https://www.artificialintelligence-news.com/",
"snippet": "AI News delivers the latest updates in artificial intelligence..."
},
{
"title": "The Latest AI News and AI Breakthroughs that Matter Most",
"link": "https://www.crescendo.ai/news/latest-ai-news-and-updates",
"snippet": "Summary: Xiaomi has announced a next-gen AI voice model...",
"contexts": [
{
"idx": 0,
"text": "December 26, 2025\n\n# The Latest AI News and AI Breakthroughs..."
}
]
}
]
}
}
响应字段
| 字段 | 类型 | 描述 |
|---|---|---|
code | integer | 200 表示成功 |
message | string | 状态信息 |
took_ms | integer | 请求耗时(毫秒) |
data.organic | array | 自然搜索结果 |
data.organic[].title | string | 页面标题 |
data.organic[].link | string | 页面 URL |
data.organic[].snippet | string | 搜索摘要 |
data.organic[].contexts | array | 可选的页面上下文内容 |
data.organic[].contexts[].idx | integer | 上下文索引 |
data.organic[].contexts[].text | string | 提取出的文本内容 |
错误返回
{
"code": 400,
"message": "Bad Request, missing query parameter"
}
价格与限制
| 项目 | 值 |
|---|---|
| 价格 | 每次成功深度搜索请求 $0.08 |
| 内部模型名 | websearch-deepsearch |
| 限流模型 | 共享账号级限额 |
| 重试行为 | 如果收到带 Retry-After 的 503 Service Unavailable,请等待后重试 |
websearch-deepsearch,并把它保存在用量和请求审计记录中;
它不是客户端需要传入的参数。
示例:给 LLM 注入 RAG 上下文
import os
import requests
from openai import OpenAI
search_response = requests.get(
"https://api.pipellm.ai/v1/websearch/search",
params={"q": "OpenAI o3 模型能力"},
headers={"Authorization": f"Bearer {os.getenv('PIPELLM_API_KEY')}"},
)
search_data = search_response.json()
context = "\n".join(
f"[{r['title']}]({r['link']}): {r['snippet']}"
for r in search_data.get("data", {}).get("organic", [])[:5]
)
client = OpenAI(
api_key=os.getenv("PIPELLM_API_KEY"),
base_url="https://api.pipellm.ai/v1",
)
response = client.chat.completions.create(
model="gpt-5",
messages=[
{"role": "system", "content": f"请基于以下上下文回答:\n{context}"},
{"role": "user", "content": "OpenAI o3 有哪些主要特性?"},
],
)
print(response.choices[0].message.content)
相关文档
WebSearch 总览
产品总览、价格和接入入口
快速搜索
更快的搜索路由,不做深度检索
pipellm-websearch(npm)
从 npm 安装 OpenClaw 插件
此页面对您有帮助吗?