截图与OG图片,一次API调用搞定。
只需一个HTTP请求即可生成OG图片:
# 简单的GET请求
curl "https://og.qfali.cc.cd/v1/og?title=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&template=basic"
# 使用全部参数
curl "https://og.qfali.cc.cd/v1/og?title=%E6%88%91%E7%9A%84%E6%96%87%E7%AB%A0&subtitle=%E4%B8%80%E7%AF%87%E5%A5%BD%E6%96%87%E7%AB%A0&template=blog&eyebrow=%E6%8A%80%E6%9C%AF&author=%E5%BC%A0%E4%B8%89"
# 或使用POST和JSON
curl -X POST https://og.qfali.cc.cd/v1/og \
-H "Content-Type: application/json" \
-d '{"title":"你好","template":"product","eyebrow":"新品"}'
传入URL即可使用任意TTF或OTF字体。无需上传 — 只需指向你的字体文件。
# 通过URL使用自定义字体
curl "https://og.qfali.cc.cd/v1/og?title=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&fontUrl=https://example.com/fonts/Poppins-Regular.ttf"
# 支持Google Fonts直链、GitHub raw链接等
curl "https://og.qfali.cc.cd/v1/og?title=%E4%BD%A0%E5%A5%BD&fontUrl=https://github.com/google/fonts/raw/main/ofl/poppins/Poppins-Regular.ttf"
# 优雅降级:字体URL失败时自动使用Inter字体
# 检查 X-Font-Fallback: true 响应头可检测降级
单次API调用最多生成20张OG图片。非常适合博客列表、站点地图和CI/CD流水线。
# 一次生成多张图片
curl -X POST https://og.qfali.cc.cd/v1/og/batch \
-H "Content-Type: application/json" \
-H "X-Api-Key: sk_..." \
-d '{
"images": [
{"id": "hero", "title": "我的产品", "template": "product"},
{"id": "blog-1", "title": "第一篇", "template": "blog", "author": "张三"},
{"id": "blog-2", "title": "第二篇", "template": "blog", "author": "李四"}
],
"defaults": {"format": "png", "width": 1200, "domain": "example.com"}
}'
# 返回JSON,每张图片为base64 data URI
# { "results": [{ "id": "hero", "success": true, "data": "data:image/png;base64,..." }, ...] }
8种内置模板,每种都完全可定制:
实时体验 — 自定义并预览你的OG图片:
虽无需密钥即可使用,注册密钥可获得用量统计功能:
curl -X POST https://og.qfali.cc.cd/v1/keys \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com"}'
# 返回: { "key": "sk_...", "tier": "free", "monthly_limit": 100000 }