← Back to list

generate-header-image
by brucehart
Personal blog built on top of Cloudflare Workers
⭐ 0🍴 0📅 Jan 25, 2026
SKILL.md
name: generate-header-image description: Generate a blog post header image via Replicate, import it into Bhart R2 media storage, and set the post hero_image_url + hero_image_alt via the Bhart Codex API.
Generate Header Image
Use this skill when the user wants to create or replace an existing post's header/hero image.
This workflow:
- generates an image with Replicate
- imports the generated image URL into the bhart.org R2 media bucket (so it is served from
/media/...) - updates the target post's
hero_image_url+hero_image_alt
Requirements
CODEX_BHART_API_TOKEN(for Bhart Blog Automation API)REPLICATE_API_TOKEN(for Replicate)
Bhart API note
This skill uses a Codex API media helper endpoint:
POST /api/codex/v1/media/import- Downloads
source_url(must be an image) into theMEDIA_BUCKETR2 bucket - Creates a
media_assetsrow in D1 - Returns
{ media: { id, key, url, ... } }whereurlis a site-local/media/<key>URL
- Downloads
Recommended workflow
- Identify the post:
GET /posts/by-slug/:slug(preferred) orGET /posts/:id
- Generate alt text:
- Keep it short, descriptive, and literal (what the image shows), not marketing copy.
- Generate the image on Replicate:
- Prefer passing the logo as an input image if the model supports it (e.g. OpenAI image models support
input_images).
- Prefer passing the logo as an input image if the model supports it (e.g. OpenAI image models support
- Import into R2:
- Call
POST /media/importwithsource_url,alt_text, and the post author fields.
- Call
- Update the post hero fields:
PATCH /posts/:idwithhero_image_url,hero_image_alt, andexpected_updated_at.
Script (preferred)
Run:
bash .codex/skills/generate-header-image/scripts/generate_header_image.sh --slug <post-slug> --prompt-file <prompt.txt> --logo-url <https://.../logo.png>
Notes:
- Set
--modeland--replicate-inputif you are using a model that needs custom input fields. - Default model is
google/nano-banana-pro. - Default aspect ratio is
16:9(header-friendly); override via--aspect-ratio. - If you omit
--replicate-input, the script uses a default input compatible withgoogle/nano-banana-pro(prompt,image_input,aspect_ratio,resolution,output_format).
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon