数据接口:天气 / IP 归属地 / 实时热搜
三个模型编不出来的实时数据接口:免密钥、国内节点直连、固定 JSON 结构,AI 客户端与 MCP 工具可直接接入。
为什么单独做这三个
GET https://tool.supubao.com/api/v1/tool/weather?city=洛阳&days=3
GET https://tool.supubao.com/api/v1/tool/ip?ip=8.8.8.8
GET https://tool.supubao.com/api/v1/tool/hot?type=weibo
POST 同样可用,参数走 JSON body:
POST https://tool.supubao.com/api/v1/tool/weather
{"city":"洛阳","days":3}
参数与返回字段
| 接口 | 参数 | 主要字段 | 缓存 |
|---|---|---|---|
| /weather | city(必填,中文城市名) days(1-7,默认 3) |
current.temp / feels_like / humidity / wind / weather;daily[].date / temp_max / temp_min / rain_prob | 15 分钟 |
| /ip | ip(必填,IPv4/IPv6) | country / region / city / isp / asn / timezone | 6 小时 |
| /hot | type(weibo 默认 / baidu) | count、list[].rank / title / hot / url | 15 分钟 |
接入示例
curl "https://tool.supubao.com/api/v1/tool/weather?city=%E6%B4%9B%E9%98%B3&days=3"
const r = await fetch('https://tool.supubao.com/api/v1/tool/hot?type=weibo');
const j = await r.json();
if (j.code === 0) console.log(j.data.list.map(x => x.title));
// POST 写法(参数含中文或较长时推荐)
await fetch('https://tool.supubao.com/api/v1/tool/weather', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ city: '洛阳', days: 3 }),
});
{
"mcpServers": {
"supubao": {
"url": "https://mcp.supubao.com/mcp"
}
}
}
缓存与降级策略
· 缓存落盘(SQLite),服务重启后仍能命中,冷启动不会瞬间打满上游
· 上游接口全部失败时,用最近一份过期数据兜底,响应里带 _cache: {stale: true, age: 秒}
· 响应附带 _quota(当前额度与剩余次数),便于客户端自行退避
· 运行状态可查:GET /api/v1/stats/upstream?hours=24,返回各接口调用量、失败率与平均耗时
数据来源与使用边界
天气 Open-Meteo(免费版,条款限制非商业用途)
IP ip-api.com 为主、ipapi.co 为备(免费版均限制非商业用途)
热搜 微博公开榜单接口 / 百度热搜公开页,非官方授权接口
结论:个人开发、学习、内部演示可以直接用;对外商用(收费服务、广告变现、
企业交付)必须换成对应服务的付费授权或国内合规数据源(如和风天气付费版、
商业 IP 库)。本站会在商用前完成替换,此页保留来说明当前状态。