Skip to content

实时 vs 批量选型指南

SeerMarTech SERP API 提供三种调用模式,选对模式可节省 60–70% 费用。

三种模式对比

模式延迟参考价/页适用场景
Live秒级(同步)≈ ¥0.032即时查询、< 10 词
Standard Queue1–5 分钟≈ ¥0.0096每日批量、100+ 词
Priority Queue较快≈ ¥0.0192批量但需更快完成

决策流程

需要 SERP 结果?

 ├─ 需要立即返回给用户? ──是──→ Live
 │ │
 └─ 否(可后台跑) │
 │ │
 ├─ 词数 < 10? ──是──→ Live(简单省事)

 ├─ 词数 10–50? ──→ Priority Queue 或 Live(看预算)

 └─ 词数 > 50? ──→ Standard Queue(最省)

成本对比示例

100 个关键词/天 为例:

模式单次 cost日费用月费用vs Live 节省
Live≈ ¥0.032≈ ¥3.20≈ ¥96
Priority Queue≈ ¥0.0192≈ ¥1.92≈ ¥5840%
Standard Queue≈ ¥0.0096≈ ¥0.96≈ ¥2970%

Live 模式示例

bash
curl -X POST "https://api.seermartech.cn/v3/serp/google/organic/live/advanced" \
 -H "Authorization: Bearer smt_live_YOUR_KEY" \
 -H "Content-Type: application/json" \
 -d '[{"keyword": "SEO工具", "location_code": 2156, "language_code": "zh"}]'

Standard Queue 模式示例

python
import time
import requests

API_KEY = "smt_live_YOUR_KEY"
BASE = "https://api.seermartech.cn/v3"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

def batch_serp(keywords: list[str]) -> list[dict]:
 results = []
 for kw in keywords:
 # 1. 提交任务
 post = requests.post(
 f"{BASE}/serp/google/organic/task_post",
 headers={**HEADERS, "Content-Type": "application/json"},
 json=[{"keyword": kw, "location_code": 2156, "language_code": "zh", "priority": 1}],
 timeout=30,
 )
 task_id = post.json["tasks"][0]["id"]

 # 2. 轮询(可改为异步回调)
 for _ in range(30):
 get = requests.get(
 f"{BASE}/serp/google/organic/task_get/advanced/{task_id}",
 headers=HEADERS,
 timeout=30,
 )
 data = get.json
 if data["tasks"][0]["status_code"] == 20000:
 results.append(data)
 break
 time.sleep(10)
 return results

# 100 词批量 ≈ ¥0.86(Standard)vs ≈ ¥2.88(Live)
results = batch_serp(["SEO工具", "关键词研究", "外链分析"])

TypeScript

typescript
async function batchSerp(keywords: string[]) {
 const results = [];
 for (const keyword of keywords) {
 const postResp = await fetch(
 "https://api.seermartech.cn/v3/serp/google/organic/task_post",
 {
 method: "POST",
 headers: {
 Authorization: "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json",
 },
 body: JSON.stringify([{ keyword, location_code: 2156, language_code: "zh", priority: 1 }]),
 }
 );
 const taskId = (await postResp.json).tasks[0].id;
 // 生产环境建议用消息队列 + worker 轮询,而非同步等待
 results.push(taskId);
 }
 return results;
}

选型建议速查

你的场景推荐模式
SaaS 工具内「查排名」按钮Live
每日 cron 跑 200 词排名Standard Queue
用户提交后 1 分钟内要结果Live 或 Priority
一次性导出 1000 词 SERPStandard Queue
开发调试 / 接口联调Sandbox + Live

批量优化技巧

  1. 并发提交 Task Post:先批量提交所有 task,再统一轮询,比串行快 5–10 倍
  2. 失败隔离:单个 task 失败不影响其他,记录 task_id 便于重试
  3. Priority 参数priority: 1 = Standard,priority: 2 = Priority
  4. 非 SERP API:关键词 API、外链 API 仅支持 Live 模式

相关文档

统一入口:官网 · LLM API · 控制台