AI-Answers API
DataForSEO 式的异步任务制 API,覆盖 doubao / yuanbao / deepseek / kimi / qwen。
抓取开启联网后的真实答案与引用来源。
鉴权
每个请求带 Authorization: Bearer <ab_key>(也支持 HTTP Basic,key 放 login 或 password 均可)。
key 以 sha-256 存储,服务端常数时间比对。
curl -H "Authorization: Bearer ab_xxx" https://answerbit.rushos.com/v3/ai/answers/tasks_ready
提交任务
POST/v3/ai/answers/task_post
批量提交(最多 100 条)。入队时按「模型 × 是否联网」预扣 credits,任务入队失败自动退款。
POST https://answerbit.rushos.com/v3/ai/answers/task_post
Authorization: Bearer ab_xxx
Content-Type: application/json
[
{ "model": "doubao", "prompt": "best noise cancelling headphones",
"web_search": true, "location": "cn", "tag": "hp-q3",
"pingback_url": "https://you.example.com/hook" }
]
-> { "ok": true, "cost": 1.5, "tasks_count": 1,
"tasks": [ { "id": "uuid", "model": "doubao", "tag": "hp-q3",
"status": "queued", "cost": 1.5 } ] }
轮询已完成
GET/v3/ai/answers/tasks_ready
GET https://answerbit.rushos.com/v3/ai/answers/tasks_ready?limit=100
-> { "ok": true, "tasks_count": 2, "tasks": [ { "id": "uuid", "model": "doubao", "status": "done", ... } ] }
取结果
GET/v3/ai/answers/task_get/{id}
GET https://answerbit.rushos.com/v3/ai/answers/task_get/<id>
-> {
"ok": true, "id": "uuid", "model": "doubao", "prompt": "...", "status": "done",
"answer_markdown": "...",
"citations": [ { "rank": 1, "title": "...", "url": "https://...", "domain": "example.com", "snippet": "..." } ],
"brand_mentions": { ... }, "raw": { ... }, "latency_ms": 4210, "tier": "tier1", "ts": "..."
}
同步 (live)
POST/v3/ai/answers/live
单条高优先级提交,服务端最多等待约 60s。完成返回 200(结果 shape 同 task_get);超时返回 202 带任务 id,改用轮询取回。
POST https://answerbit.rushos.com/v3/ai/answers/live
{ "model": "deepseek", "prompt": "top CRM tools 2026", "web_search": true }
Pingback
WP6 任务完成后向 pingback_url 回调(对齐 DataForSEO)。当前采集引擎直接写 ab_results;回调由后续 Cron watcher 触发,字段已预留。
错误
| 状态 | error | 含义 |
|---|---|---|
| 401 | missing_api_key / invalid_api_key | 缺少或无效 key |
| 403 | key_disabled | key 已停用 |
| 400 | invalid_model / missing_prompt / invalid_json | 请求体校验失败 |
| 402 | insufficient_credits | 余额不足(附 needed / available) |
| 429 | rate_limited | 超过每分钟限额(附 Retry-After) |