AI Thumbnail Generation API — YouTube & Blog Thumbnails (2026)
Your video platform publishes 200 new uploads a day, and every one needs a thumbnail before it goes live. Hiring a designer to hand-craft each one doesn't scale, and generic auto-crops from the video frame convert worse than a purpose-built thumbnail. The fix is generating thumbnails from a prompt — or from a reference frame — at upload time, via API.
This guide covers model selection for thumbnail work, the 16:9 and 1:1 aspect ratio configs YouTube and blog platforms expect, a batch generation pattern, and cost math at scale using GenRelay.
Which Image Model Should I Use for Thumbnails?
For most thumbnail work, GPT-image-2 is the practical default — it's the lowest per-image cost on GenRelay at $0.014/image, and thumbnails are typically viewed at small sizes where a 1K-equivalent output is indistinguishable from higher resolutions. Reach for Nano Banana Pro or Nano Banana 2 when you need reference-guided generation — for example, reusing a channel's recurring host photo or brand mascot across thumbnails.
| Model | Cost per image | Best for |
|---|---|---|
| GPT-image-2 | $0.014 | Default choice — text-to-image or instruction-based edits, lowest cost |
| Nano Banana 2 (1K) | $0.020 | Reference-guided thumbnails (consistent host/brand across a series) |
| Nano Banana Pro (1K/2K) | $0.030 | Higher-detail thumbnails for larger display placements (channel art, blog hero crops) |
Definition: reference-guided generation means the model accepts one or more input images alongside the prompt, and produces new output that preserves a subject's appearance — useful for keeping the same face, logo, or product consistent across a batch of thumbnails.
How Do I Set the Right Aspect Ratio for Each Platform?
Pass aspect_ratio in the request body — "16:9" for YouTube thumbnails, "1:1" for blog card grids, and "4:3" for some legacy CMS layouts. All three GenRelay image models accept this parameter.
import requests
API_KEY = "YOUR_GENRELAY_KEY"
def generate_thumbnail(prompt, aspect_ratio="16:9", model="gpt-image-2"):
response = requests.post(
"https://genrelay.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"model": model,
"prompt": prompt,
"aspect_ratio": aspect_ratio
}
)
return response.json()["data"][0]["url"]
thumbnail_url = generate_thumbnail(
"Bold YouTube thumbnail, tech reviewer holding a smartphone, "
"shocked expression, bright red arrow pointing at the screen, "
"high contrast, large readable text space on the left"
)
print(thumbnail_url)
YouTube's recommended thumbnail size is 1280×720 (16:9). If your platform also needs a square crop for a related-content grid, generate a second variant at "1:1" rather than cropping the 16:9 output — cropping risks cutting off the subject or text region that made the composition work.
How Do I Generate a Reference-Guided Thumbnail Series?
Pass a reference image alongside the prompt to keep a recurring subject — a host, a mascot, a product — visually consistent across a batch of videos. Nano Banana Pro and Nano Banana 2 both support this via the reference_images field.
import requests
import base64
def generate_with_reference(prompt, reference_path, model="nano-banana-2"):
with open(reference_path, "rb") as f:
ref_b64 = base64.b64encode(f.read()).decode()
response = requests.post(
"https://genrelay.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"model": model,
"prompt": prompt,
"reference_images": [ref_b64],
"aspect_ratio": "16:9"
}
)
return response.json()["data"][0]["url"]
url = generate_with_reference(
"Same host from the reference photo, excited expression, "
"pointing at a glowing product mockup, YouTube thumbnail style",
"host_reference.jpg"
)
This keeps the host's face and general likeness consistent across every video's thumbnail, while the pose, expression, and background change per prompt. For a deeper walkthrough of reference-guided consistency patterns, see how to maintain visual consistency in AI-generated images.
How Do I Batch-Generate Thumbnails for a Content Queue?
Submit requests concurrently with a bounded worker pool rather than one at a time — image generation on GenRelay responds synchronously (5–15 seconds per image), so sequential requests for a 200-video queue would take 15–50 minutes.
from concurrent.futures import ThreadPoolExecutor, as_completed
def process_queue(video_prompts, max_workers=8):
results = {}
with ThreadPoolExecutor(max_workers=max_workers) as pool:
futures = {
pool.submit(generate_thumbnail, prompt): video_id
for video_id, prompt in video_prompts.items()
}
for future in as_completed(futures):
video_id = futures[future]
try:
results[video_id] = future.result()
except Exception as e:
print(f"Failed for {video_id}: {e}")
return results
Cap concurrency at 8–10 workers to stay comfortably under per-account rate limits — see the AI video API rate limits guide for the general pattern, which applies to the image endpoint as well.
What Does Thumbnail Generation Cost at Scale?
At 200 thumbnails/day with GPT-image-2, the monthly cost is 200 × 30 × $0.014 = $84/month. Switching to Nano Banana 2 for reference-guided consistency raises that to 200 × 30 × $0.020 = $120/month.
| Volume | GPT-image-2 | Nano Banana 2 (1K) | Nano Banana Pro (1K/2K) |
|---|---|---|---|
| 200/day (6,000/mo) | $84 | $120 | $180 |
| 1,000/day (30,000/mo) | $420 | $600 | $900 |
| 5,000/day (150,000/mo) | $2,100 | $3,000 | $4,500 |
A practical pattern: generate two variants per video with GPT-image-2 (cheap enough to A/B test), and only fall back to Nano Banana 2's reference-guided mode for series where host consistency matters. For general cost patterns across all three image models, see the AI image generation API pricing comparison.
Internal Links
- Nano Banana Pro on GenRelay
- AI image aspect ratio API — landscape, portrait, and square configs
- Batch image generation via API — concurrency patterns
FAQ
What image size should I request for YouTube thumbnails?
YouTube recommends 1280×720 pixels minimum, 16:9 aspect ratio. Request "aspect_ratio": "16:9" — the API returns an image sized appropriately for that ratio, which meets YouTube's minimum without upscaling.
Can I generate a thumbnail from an existing video frame instead of a text prompt?
Yes, using instruction-based editing. Pass the extracted frame to GPT-image-2's edit endpoint (/v1/images/edits) with an instruction like "make this a bold YouTube thumbnail with high contrast and space for text." This preserves the original scene while restyling it for thumbnail use.
Does the API add any watermark to generated thumbnails?
No. Images returned by GenRelay are production-ready with no watermark. See the AI generation API with no watermark explainer for details across all three image models.
How do I keep text legible when the model generates it directly in the image?
Model-generated text in images is inconsistent across all three models. For reliable, legible titles, generate the background/scene via API, then overlay text using a library like Pillow (Python) or Canvas (JavaScript) as a separate step, rather than relying on the model to render text.
Is there a free tier to test thumbnail generation before committing?
Yes. GenRelay includes free credits on signup, enough to test thumbnail prompts and reference-guided generation across all three image models before moving to a paid plan.
As of September 2026. Pricing subject to change — verify current rates at genrelay.ai.