Scaff Search API 中文文档
免费的网络搜索API,专为AI代理、LLM应用和开发者打造。无需API密钥,无需注册,即刻使用。
快速开始
curl "https://search.scaff.dev/api/search?q=你的搜索词"
返回格式(JSON)
{
"query": "人工智能",
"count": 10,
"results": [
{
"title": "结果标题",
"url": "https://example.com",
"snippet": "结果摘要...",
"engine": "bing"
}
],
"source": "searxng (bing, yahoo)",
"duration": 0.35
}
API 参数
| 参数 | 说明 | 默认值 |
|---|---|---|
q | 搜索关键词(必填) | — |
num | 返回结果数量(1-20) | 10 |
page | 分页页码(1-10) | 1 |
lang | 搜索语言(zh, en, ja...) | en |
safe | 安全搜索(1=开启) | 0 |
Python 示例
import requests
response = requests.get("https://search.scaff.dev/api/search", params={
"q": "大模型本地部署",
"num": 5,
"lang": "zh"
})
data = response.json()
for result in data["results"]:
print(f"{result[title]}: {result[url]}")
在 AI 代理中使用
Scaff Search 非常适合集成到 AI 代理和 LLM 应用中:
- 无需API密钥 — 直接调用,无需注册
- JSON 格式 — 结构化数据,方便解析
- MCP 协议支持 — 通过
POST https://search.scaff.dev/mcp使用 MCP 工具web_search - 多语言支持 — 支持中文、英文、日文等多种语言搜索
- 多引擎聚合 — 聚合 Bing、Yahoo、Yandex、Mojeek 等多个搜索引擎
LangChain 集成
from langchain_core.tools import tool
@tool
def web_search(query: str) -> list[dict]:
"""搜索网络获取最新信息"""
import requests
r = requests.get("https://search.scaff.dev/api/search",
params={"q": query, "num": 5})
return r.json()["results"]
Ollama / 本地大模型集成
如果你在本地部署 Ollama、Qwen、ChatGLM 等大模型,可以通过 Scaff Search 为模型添加实时网络搜索能力:
import requests
import json
def search_web(query):
"""为本地大模型提供网络搜索工具"""
r = requests.get("https://search.scaff.dev/api/search",
params={"q": query, "num": 3, "lang": "zh"})
results = r.json()["results"]
context = "\n".join(f"- {r[title]}: {r[snippet]}" for r in results)
return context
# 在 Ollama 对话中使用搜索结果
query = "Qwen3-8B 需要多大显存"
search_context = search_web(query)
prompt = f"根据以下搜索结果回答问题:\n{search_context}\n\n问题:{query}"