Free Dev Apis

开发者收藏!5 个必用免费 API

做项目不需要花钱买 API


1. CoinGecko - 加密货币

地址:https://www.coingecko.com/ 免费:10-30 次/分钟 返回:价格 / 市值 / 24h 变化

// 获取 BTC 价格
fetch('https://api.coingecko.com/v3/simple/price?ids=bitcoin&vs_currencies=cny')
  .then(r => r.json())
  .then(data => console.log(data.bitcoin.cny))

评价:⭐⭐⭐⭐⭐ 最全加密数据


2. Open-Meteo - 天气

地址:https://open-meteo.com/ 免费:无限 无需 API Key

// 北京天气
fetch('https://api.open-meteo.com/v1/forecast?latitude=39.9&longitude=116.4&current_weather=true')
  .then(r => r.json())
  .then(data => console.log(data.current_weather))

评价:⭐⭐⭐⭐⭐ 比付费好用


3. IPstack - IP 查询

地址:https://ipstack.com/ 免费:100 次/月

// 获取 IP 信息
fetch('http://api.ipstack.com/your-api-key?access_key=YOUR_KEY')
  .then(r => r.json())
  .then(data => console.log(data.city, data.country))

评价:⭐⭐⭐⭐ 定位精准


4. Numbers API - 数字

地址:http://numbersapi.com/ 免费:无限

// 随机数字事实
fetch('http://numbersapi.com/random/trivia?json')
  .then(r => r.json())
  .then(data => console.log(data.text))

评价:⭐⭐⭐ 有趣


5. JokeAPI - 笑话

地址:https://v2.jokeapi.dev/ 免费:无限

// 随机笑话
fetch('https://v2.jokeapi.dev/Any?safe-mode')
  .then(r => r.json())
  .then(data => console.log(data.joke))

评价:⭐⭐⭐⭐ 开发娱乐


免费 API 总结

API 用途 免费额度
CoinGecko 币价 10-30/min
Open-Meteo 天气 无限
IPstack IP 100/月
Numbers 数字 无限
JokeAPI 笑话 无限

做项目之前先看看有没有免费的!


原文:https://zzshare.top/article/

/*]]>*/