← 返回首页

📘 灵云API 开发文档

稳定、高性价比的天气/汇率/利润计算等接口,多源兜底,生产级可用。
🔑 身份验证
所有接口支持两种身份验证方式(二选一): 基础 URL:https://lingyunai.cn/api/

💰 跨境财税

实时汇率 GET

/api/rate?from={源货币}&to={目标货币}
参数必填说明
from源货币代码,如 USD、CNY
to目标货币代码,如 CNY、EUR
请求示例
GET /api/rate?from=USD&to=CNY
返回示例
{
  "node": "income_node_1",
  "exchange_rate": 6.9032,
  "from": "USD",
  "to": "CNY",
  "last_updated": "2026-02-23",
  "api_used": "Alpha Vantage",
  "real_data": true
}

历史汇率 GET

/api/rate-history?from={源货币}&to={目标货币}&date={日期}
参数必填说明
from源货币代码
to目标货币代码
date日期,格式 YYYY-MM-DD
请求示例
GET /api/rate-history?from=USD&to=CNY&date=2024-02-01
返回示例
{
  "node": "rate-history",
  "date": "2024-02-01",
  "from": "USD",
  "to": "CNY",
  "rate": 7.1822,
  "api_used": "Frankfurter",
  "real_data": true
}

增值税查询 GET

/api/vat?country={国家代码}
参数必填说明
country国家代码,如 DE(德国)、CN(中国)
请求示例
GET /api/vat?country=DE
返回示例
{
  "node": "vat",
  "country": "DE",
  "vat_rates": {"standard": 19},
  "api_used": "VAT Sense",
  "real_data": true
}

利润计算器 POST

/api/profit

请求体(JSON)

参数必填说明
cost采购价(¥)
qty数量
shipping运费(¥/件)
commission平台佣金(%)
price目标售价(¥/件)
tariffRate关税率(%)
rate汇率(CNY/USD)
vatRate增值税率(%)
请求示例
POST /api/profit
Content-Type: application/json

{
  "cost": 100,
  "qty": 10,
  "shipping": 20,
  "commission": 15,
  "price": 200,
  "tariffRate": 5,
  "rate": 7.2,
  "vatRate": 13
}
返回示例
{
  "node": "profit-calculator",
  "calculation": {
    "totalCost": "1000.00",
    "totalShipping": "200.00",
    "tariff": "50.00",
    "vat": "130.00",
    "commissionFee": "300.00",
    "totalRevenue": "2000.00",
    "profit": "320.00",
    "margin": "16.0%",
    "breakevenPrice": "151.02"
  },
  "disclaimer": "本计算结果为预估参考,不构成实际报价依据。"
}

🌤️ 户外气象

实时天气 GET

/api/weather?lat={纬度}&lon={经度}

或使用城市名:/api/weather?city=北京(内置城市映射)

参数必填说明
lat与lon成对纬度
lon与lat成对经度
city与经纬度互斥城市名(支持中国主要城市)
请求示例
GET /api/weather?lat=39.9042&lon=116.4074
返回示例
{
  "node": "income_node_2",
  "temperature": 4,
  "weathercode": 3,
  "lat": 39.9042,
  "lon": 116.4074,
  "api_used": "Open-Meteo",
  "real_data": true
}

空气质量 (AQI) GET

/api/aqi?lat={纬度}&lon={经度}

同样支持 ?city=北京 模式

请求示例
GET /api/aqi?lat=39.9042&lon=116.4074
返回示例
{
  "node": "aqi",
  "aqi": 80,
  "pm25": 35,
  "pm10": 60,
  "lat": 39.9042,
  "lon": 116.4074,
  "api_used": "Open-Meteo AQI",
  "real_data": true
}

降水预报 GET

/api/precip?lat={纬度}&lon={经度}

支持城市名模式

请求示例
GET /api/precip?lat=39.9042&lon=116.4074
返回示例
{
  "node": "precip",
  "forecast": [
    {"time": "2026-02-21T00:00", "precip": 0},
    {"time": "2026-02-21T01:00", "precip": 0.2}
  ],
  "lat": 39.9042,
  "lon": 116.4074,
  "api_used": "Open-Meteo Precip",
  "real_data": true
}

灾害预警 GET

/api/alert?lat={纬度}&lon={经度}

支持城市名模式

请求示例
GET /api/alert?lat=39.9042&lon=116.4074
返回示例
{
  "node": "alert",
  "alerts": [
    {
      "title": "大风蓝色预警",
      "typeText": "气象预警",
      "levelText": "蓝色",
      "description": "预计未来24小时将出现大风天气",
      "published": "2026-02-21T10:00:00Z"
    }
  ],
  "point": {"lat":39.9042,"lon":116.4074},
  "api_used": "qweather",
  "real_data": true
}

🆓 免费工具

IP查询 GET

/api/ip?ip={可选IP}

不传 IP 则查询请求来源的公网 IP。

请求示例
GET /api/ip?ip=8.8.8.8
返回示例
{
  "node": "ip",
  "data": {
    "ip": "111.229.103.156",
    "country": "China",
    "city": "Shanghai"
  }
}

二维码生成 GET

/api/qrcode?text={文本或网址}
请求示例
GET /api/qrcode?text=https://lingyunai.cn
返回示例
{
  "node": "qrcode",
  "data": {
    "qr": "data:image/png;base64,...",
    "text": "https://lingyunai.cn"
  }
}

短链接生成 POST

/api/shortlink/create

请求体(JSON)

参数必填说明
url长网址
请求示例
POST /api/shortlink/create
Content-Type: application/json

{"url": "https://example.com/long/url"}
返回示例
{
  "node": "shortlink",
  "data": {
    "short": "https://lingyunai.cn/s/abc123",
    "long": "https://example.com/long/url"
  }
}

查吉日 GET

/api/auspicious?date={日期}
参数必填说明
date日期,格式 YYYY-MM-DD
请求示例
GET /api/auspicious?date=2026-02-23
返回示例
{
  "node": "auspicious",
  "data": {
    "solar": "2026-02-23",
    "lunar": "二〇二六年正月初七",
    "yi": ["会亲友", "冠笄", "安床"],
    "ji": ["嫁娶", "开市", "动土"]
  }
}

📢 所有付费节点均支持免费试用(7天,每天1000次),试用期无需付费,直接使用访客ID即可。

💰 付费套餐:单节点 19.9元/月,单场景(4节点)29.9元/月,双场景(8节点)39.9元/月。支持开发票,对公付款。

📞 遇到问题或需要定制需求?扫码添加微信: