> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipellm.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 新闻搜索

> 通过 PipeLLM WebSearch 搜索近期新闻并返回检索结果

当你想搜索近期新闻，而不是通用网页结果时，使用这条路由。

## Endpoint

| 方法    | 端点                                                |
| ----- | ------------------------------------------------- |
| `GET` | `https://api.pipellm.ai/v1/websearch/search-news` |

## 认证

```text theme={null}
Authorization: Bearer $PIPELLM_API_KEY
```

## 查询参数

| 参数  | 类型     | 必填 | 描述      |
| --- | ------ | -- | ------- |
| `q` | string | 是  | 新闻搜索关键词 |

## 请求示例

```bash theme={null}
curl -X GET "https://api.pipellm.ai/v1/websearch/search-news?q=OpenAI" \
  -H "Authorization: Bearer $PIPELLM_API_KEY"
```

## 响应结构

```json theme={null}
{
  "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 会根据路由自动确定模型名，客户端不需要传入。

## 相关文档

<Columns cols={3}>
  <Card title="深度搜索" icon="magnifying-glass" href="/websearch/search-api.zh">
    在通用网页上做带检索支持的搜索
  </Card>

  <Card title="快速搜索" icon="bolt" href="/websearch/simple-search.zh">
    如果不需要新闻专用检索，可以走更快的摘要搜索
  </Card>

  <Card title="WebSearch 总览" icon="globe" href="/websearch/overview.zh">
    查看产品总览和路由矩阵
  </Card>
</Columns>
