搜索新闻
curl --request GET \
--url https://api.pipellm.ai/v1/websearch/search-news \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pipellm.ai/v1/websearch/search-news"
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-news', 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-news"
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-news
搜索新闻
curl --request GET \
--url https://api.pipellm.ai/v1/websearch/search-news \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pipellm.ai/v1/websearch/search-news"
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-news', 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-news"
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))
}当你想搜索近期新闻,而不是通用网页结果时,使用这条路由。
Endpoint
| 方法 | 端点 |
|---|---|
GET | https://api.pipellm.ai/v1/websearch/search-news |
认证
Authorization: Bearer $PIPELLM_API_KEY
查询参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 是 | 新闻搜索关键词 |
请求示例
curl -X GET "https://api.pipellm.ai/v1/websearch/search-news?q=OpenAI" \
-H "Authorization: Bearer $PIPELLM_API_KEY"
响应结构
{
"code": 200,
"message": "ok",
"took_ms": 4200,
"data": {
"organic": [
{
"title": "Latest OpenAI news",
"link": "https://example.com/news",
"snippet": "Recent product and research updates...",
"contexts": [
{
"idx": 0,
"text": "..."
}
]
}
]
}
}
说明
- 这条路由代理到内部
/api/search-news。 - 它会先走新闻搜索源,再套用和深度搜索相同的检索链路。
- 如果没有结果,这条路由会返回
404,响应体里会包含code: 404和message: "no search results"。 - 每次成功请求价格为 $0.08,并以内部模型名
websearch-news记录。 - PipeLLM 会根据路由自动确定模型名,客户端不需要传入。
相关文档
深度搜索
在通用网页上做带检索支持的搜索
快速搜索
如果不需要新闻专用检索,可以走更快的摘要搜索
WebSearch 总览
查看产品总览和路由矩阵
此页面对您有帮助吗?