加载中…
默认按 User-Agent 判断横竖(手机竖图、电脑横图),按 Accept 选格式(支持 AVIF 就给 AVIF)。方图两端都能抽到;请求的格式不存在时按 avif → webp → jpg 回退。
整数用拒绝采样,没有取模偏差;小数用 53 位随机精度拼出来。
开了哪类字符,结果里就一定有哪类。
GET /api/number | 随机数:?min=&max=&n=&unique=&decimals= |
|---|---|
GET /api/string | 随机字符串/口令:?length=&lower=&upper=&digits=&symbols=&underscore= |
GET /api/daily | 每日一句:同一天所有人拿到同一句,带一天缓存 |
GET /api/hitokoto | 一言,字段兼容 hitokoto(现成组件直接可用)。支持 ?type=d |
GET /api/quote | 一言简版:{ quote, from, fromWho, type } |
GET /api/quotes?n=5 | 批量随机,不重复 |
GET /api/image | 图片信息:{ url, width, height, orientation, format, formats, bytes }。支持 ?tag=、?orientation=、?format= |
GET /api/image/raw | 302 跳到图片本身,可直接写进 <img src>,响应头带 x-image-orientation、x-image-format |
GET /api/random | 同上,短链接 |
GET /api/all | 一言 + 图片一起返回 |
GET /api/stats | 数量统计,用来确认部署成功 |
全部允许跨域,随机接口不缓存。
| 图片 | <img src="/api/random"> |
|---|---|
| 一言 | fetch('/api/hitokoto').then(r => r.json()) |