快速开始
注册账号、复制 API Key,大约五分钟完成第一次搜索调用。
SerpHubAPI 用一个接口、一种返回格式,提供 Google、Bing、Yandex、DeepSeek 等多家搜索服务(服务目录)。按本页操作,几分钟内就能跑通第一次调用。
1. 注册账号
- 打开 serphubapi.com,点击 注册。
- 输入邮箱,我们会发送一次性验证码——不需要设置密码。
- 填入验证码即完成注册,账户自动获得 1,000 赠送积分(约 100 次实时搜索),有效期 30 天,无需绑卡。
2. 复制 API Key
登录后进入控制台总览,你的第一个 API Key 只会显示这一次——请立即复制,保存到密码管理器或密钥管理系统里。我们只保存 Key 的哈希值,之后无法再次查看。
Key 的格式如下:
shapi_xxxxxxxxxxxxxxxxxxxxxxxx
如果弄丢了,到 /dashboard/keys 新建一个,并停用旧 Key 即可。
下面的示例把 Key 放在环境变量里:
export SERPHUBAPI_API_KEY="shapi_xxxxxxxx"
3. 发起第一次调用
所有请求都发往 https://api.serphubapi.com,Key 放在请求头 X-API-Key 中。
curl
curl -X POST https://api.serphubapi.com/v1/search \
-H "X-API-Key: $SERPHUBAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "best espresso machine 2026", "engine": "google", "gl": "us", "hl": "en", "num": 10}'
Python(httpx)
import os
import httpx
resp = httpx.post(
"https://api.serphubapi.com/v1/search",
headers={"X-API-Key": os.environ["SERPHUBAPI_API_KEY"]},
json={"q": "best espresso machine 2026", "engine": "google", "gl": "us", "hl": "en"},
timeout=30,
)
resp.raise_for_status()
data = resp.json()
for r in data["results"].get("organic", []):
print(r["position"], r["title"], r["link"])
print("本次扣费积分:", data["meta"]["credits_charged"])
习惯用 requests?写法完全一样:requests.post(url, headers=..., json=..., timeout=30)。
Node.js(fetch,Node 18+)
const resp = await fetch("https://api.serphubapi.com/v1/search", {
method: "POST",
headers: {
"X-API-Key": process.env.SERPHUBAPI_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ q: "best espresso machine 2026", engine: "google", gl: "us", hl: "en" }),
});
if (!resp.ok) throw new Error((await resp.json()).error.message);
const data = await resp.json();
for (const r of data.results.organic ?? []) console.log(r.position, r.title, r.link);
console.log("本次扣费积分:", data.meta.credits_charged);
4. 看懂返回结果
{
"meta": {
"id": "sch_01J9Z3KQ8W",
"status": "success",
"engine": "google",
"cached": false,
"credits_charged": 10,
"time_ms": 812
},
"params": { "q": "best espresso machine 2026", "engine": "google", "type": "web", "num": 10, "page": 1, "gl": "us", "hl": "en", "mode": "live" },
"results": {
"organic": [
{ "position": 1, "title": "...", "link": "https://...", "snippet": "..." }
],
"people_also_ask": [],
"related_searches": []
}
}
meta.id是本次调用的 ID。之后可以用GET /v1/searches/{id}回看结果,联系客服时也请提供它。meta.credits_charged是本次实际扣除的积分。google/web实时搜索 10 积分(其他服务见服务目录);调用失败或搜索无结果均为 0。
下一步
- 搜索接口参考——所有参数、结果类型与引擎。
- 鉴权——Key 的用法、限额与限流响应头。
- 接入 AI Agent——一次调用同时拿到网页正文和 Markdown 输出。
- MCP 接入——把 SerpHubAPI 加进 Claude Code、Cursor 或 Claude Desktop。
- 在 /dashboard/usage 查看用量,在 /dashboard/logs 查看每一次调用。