随机图片 · 一言 API

数据都在仓库里,没有外部依赖。点按钮换一条。

随机一言

加载中…

随机图片

随机图片

默认按 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/raw302 跳到图片本身,可直接写进 <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())