https://api.open-meteo.com/v1/forecasthttps://api.open-meteo.com/v1/forecast?latitude=39.9&longitude=116.4¤t_weather=trueOpen-Meteo 是开源气象接口,按经纬度返回实时天气,全球覆盖,免费且不需要密钥、不需要注册。
latitude 纬度、longitude 经度,国内常用坐标:北京 39.9 / 116.4,上海 31.2 / 121.5,广州 23.1 / 113.3,成都 30.6 / 104.1。
current_weather 传 true 才会返回当前天气块,里面 temperature 是摄氏度、windspeed 是 km/h、weathercode 是天气代码(0 晴、1-3 多云、45/48 雾、51-67 雨、71-77 雪、95-99 雷暴)。
接口按调用次数限流,个人站点足够用;要做多城市展示建议服务端缓存 10 分钟。
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
latitude |
number | 必填 | 39.9 | 纬度,北京 39.9、上海 31.2 |
longitude |
number | 必填 | 116.4 | 经度,北京 116.4、上海 121.5 |
current_weather |
string | 选填 | true | 传 true 返回当前天气 |
https://api.open-meteo.com/v1/forecast
此处将显示接口返回结果…
{
"latitude": 39.875,
"longitude": 116.375,
"current_weather": {
"temperature": 8.3,
"windspeed": 5.4,
"winddirection": 210,
"weathercode": 3,
"time": "2026-11-21T12:00"
}
}
—