---
title: "快速开始"
description: "只需完成以下 2 个步骤，即可在几分钟内将博查搜索能力嵌入您的业务系统或智能体。"
slug: "/guides/quickstart"
sidebarTitle: "快速开始"
updated: "2026-10-12"
---

# 快速开始

<div className="bocha-demo-grid bocha-demo-grid--steps">
  <section className="bocha-demo-card bocha-demo-card--step">
    <span className="bocha-demo-icon" aria-hidden="true"><Icon icon="key-round" size={18} /></span>

<p className="bocha-demo-card-title">1. 获取专属 API Key</p>

点击文字下方「创建API Key」即可快速创建密钥，开发者可在控制台查看当前可用的调用额度。


<a className="bocha-demo-cta" href="https://open.bochaai.com/api-keys" target="_blank" rel="noopener noreferrer">创建 API Key <span aria-hidden="true">→</span></a>
  </section>

  <section className="bocha-demo-card bocha-demo-card--step">
    <span className="bocha-demo-icon" aria-hidden="true"><Icon icon="send" size={18} /></span>

<p className="bocha-demo-card-title">2. 发起首次搜索请求</p>

通过标准 HTTP POST 或 Python / Node.js 客户端发起请求，获取结构化全网搜索结果。

<a className="bocha-demo-cta" href="/api/web-search">查看接口文档 <span aria-hidden="true">→</span></a>
  </section>
</div>

## Python 极速上手示例

将下方示例中的 `BOCHA_API_KEY` 替换为你自己的 API Key，再运行。

```python
import requests

BOCHA_API_KEY = "sk-xxxxxxxx"  # 替换为你的 API Key

url = "https://api.bocha.cn/v1/web-search"
headers = {
    "Authorization": f"Bearer {BOCHA_API_KEY}",
    "Content-Type": "application/json",
}

# 构建查询参数。
payload = {
    "query": "2026年开源大模型与AI智能体发展现状",
    "count": 10,
    "freshness": "noLimit",
    "summary": True,
}

# 发送请求并解析结构化网页结果。
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
results = response.json()

for item in results["data"]["webPages"]["value"]:
    print(f"标题: {item['name']}")
    print(f"链接: {item['url']}")
    print(f"摘要: {item['summary']}\n")
```

生产环境请改用服务端环境变量或密钥管理系统保存 API Key，不要把密钥硬编码在代码或版本库中。


<section className="bocha-demo-next">

<p className="bocha-demo-next-title">下一步建议</p>

- 阅读 [Web Search 接口文档](/api/web-search)，了解完整参数与响应结构。
- 在 [API参考](/api-reference/web-search) 中在线调试接口。
- 在 [常见问题](/guides/faq) 中排查高频接入故障/问题。

</section>
