随机图片

GETPOST 趣味娱乐 随机图片picsum

获取一张随机图片链接,支持自定义宽高

GET https://api.tinyaii.cn/v1/random/image

请求参数

参数名类型必填说明示例
widthinteger可选图片宽度(默认 800)800
heightinteger可选图片高度(默认 600)600

返回字段

字段类型说明
codeint状态码
urlstring随机图片链接
widthint图片宽度
heightint图片高度
formatstring图片格式
sourcestring图片来源
messagestring状态信息

返回示例

{
  "code": 200,
  "data": {
    "url": "https://picsum.photos/seed/123456/800.jpg",
    "width": 800,
    "height": 600,
    "format": "jpg"
  },
  "message": "success"
}

调用示例

curl "https://api.tinyaii.cn/v1/random/image?width=800&height=600" \
  -H "Authorization: Bearer YOUR_API_KEY"
const res = await fetch("https://api.tinyaii.cn/v1/random/image?width=800&height=600", {
  headers: { "Authorization": "Bearer YOUR_API_KEY" },
});
console.log(await res.json());
import requests

resp = requests.get(
    "https://api.tinyaii.cn/v1/random/image",
    params={"width": "800", "height": "600"},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    timeout=10,
)
print(resp.json())

把 YOUR_API_KEY 换成你的密钥即可直接运行。密钥只保存在你自己的设备上。