TL;DR: Tired of wasting time finding illustrations for blog posts. Built a plugin that generates featured images with one click inside WordPress. Freepik gives you $5 credit on signup — enough for 100-250 images for free.
The Problem: Illustrations Eat Your Time
Anyone who runs a blog knows this pain: you write the post, proofread it, format it — then spend another 30 minutes searching for the right image.
My options before:
- Stock photos — look the same on every website, boring
- Canva — good, but extra steps: open, design, export, upload
- DALL-E / Midjourney — great quality, but clunky workflow: generate separately, download, upload to WordPress
- Manual design — best results, but unrealistic for every post
I wanted something simple: click a button in WordPress → image is generated and set as featured image.
The Solution: Custom Plugin + Freepik API
Why Freepik:
- 6 quality models — from HyperFlux (ultra-fast) to Flux 2 Pro (premium quality)
- Output format choice — WebP, AVIF, JPEG, PNG
- Simple API — clear documentation, logical endpoints
- $5 free credit — Freepik gives you $5 on signup, enough for 100-250 generations
- Fair pricing — from ~$0.02 per image
Building with Claude Code
I built the entire plugin in one evening using Claude Code. The process:
- Described what I wanted: “WordPress plugin, metabox in editor, Generate button, Freepik API call, save as featured image”
- Claude generated the basic structure
- A few iterations to refine: settings page, model selection, category styles
- Testing and fixes
Total time: ~4 hours from idea to working plugin.
What the Plugin Does
🎨 AI Model Selection
The plugin supports 6 models for any use case and budget:
| Model | Best For | Quality | Speed |
|---|---|---|---|
| Mystic | Illustrations, flat design | Excellent | Medium |
| Flux Dev | General purpose | Good | Fast |
| Flux Pro 1.1 | Maximum quality | Premium | Slow |
| Flux 2 Pro | Latest premium | Premium | Medium |
| Flux 2 Turbo | Fast premium | Premium | Fast |
| HyperFlux | Speed priority | Good | Ultra Fast |
My picks: Mystic for blog illustrations, HyperFlux when I need something quick.
🖼️ Output Formats
Choose the image format that fits your needs:
| Format | Best For | File Size |
|---|---|---|
| WebP | Modern browsers (recommended) | Small |
| AVIF | Latest browsers | Smallest |
| JPEG | Maximum compatibility | Medium |
| PNG | Transparency support | Large |
Recommendation: WebP offers the best balance of quality and file size.
📐 Image Formats
- 1:1 — social media
- 4:3 — classic
- 2:1 — blog headers (recommended)
- 16:9 — video thumbnails
- 9:16 — stories
🎯 Smart Prompts
The plugin automatically builds prompts from:
- Post title
- Category
- Excerpt (first 100 characters)
- Configured style for the category
Example system prompt:
Create a professional blog header image for an article titled "{title}".
Style: {style_description}.
Include elements: {elements}.
Mood: {mood}.
Category: {category}.
🏷️ Category Styles
Configure unique visual styles for each blog category:
Category: "taxes"
Colors: "deep blue, gold accents, corporate feel"
Elements: "documents, calculator, charts"
Mood: "professional, trustworthy"
Now all posts in “Taxes” category will have a consistent visual style.
⚡ Auto-Generation
Optional: the plugin can automatically generate an image when a post is published if no featured image is set.
How It Looks
A metabox appears in the WordPress editor called “AI Image Generator”:
- See a style preview based on post category
- Click “Generate Image”
- Wait 10-30 seconds
- Image is automatically set as featured image
Don’t like the result? The “Regenerate” button creates a new variation.

Results
Several examples of the plugin’s performance on a finance website

appears in the WordPress editor called “AI Image Generator”:
- See a style preview based on post category
- Click “Generate Image”
- Wait 10-30 seconds
- Image is automatically set as featured image
Don’t like the result? The “Regenerate” button creates a new variation.
Installation & Setup
Step 1: Get Freepik API Key
- Sign up at freepik.com/api
- Bonus: Freepik credits you $5 on signup
- Copy your API key from the dashboard
Step 2: Install the Plugin
# Option 1: Clone from GitHub
cd wp-content/plugins/
git clone https://github.com/nesmachny/freepik-featured-image-generator.git
# Option 2: Download ZIP and upload via WordPress admin
Step 3: Configure
- Activate the plugin in WordPress
- Go to Settings → AI Image Generator
- Paste your API key
- Choose default model
- Configure category styles (optional)
Economics: What Does It Cost?
Starting balance: $5 (free on signup)
Cost per generation (approximate):
- HyperFlux: ~$0.02 (cheapest)
- Flux Dev: ~$0.03
- Mystic: ~$0.04
- Flux 2 Turbo: ~$0.05
- Flux 2 Pro: ~$0.06
- Flux Pro 1.1: ~$0.08
$5 gets you:
- ~250 images with HyperFlux
- ~160 images with Flux Dev
- ~100 images with Mystic
- ~60 images with Flux Pro 1.1
For a small blog (2-4 posts per week), the free $5 lasts 6-12 months. After that — pennies per post.
REST API for Automation
The plugin provides REST API for integrations:
# Generate image for a post
POST /wp-json/aifig/v1/generate/{post_id}
# Custom prompt
POST /wp-json/aifig/v1/custom
{
"prompt": "Futuristic cityscape with flying cars",
"post_id": 123
}
Connect to n8n, Zapier, or your own scripts.
Tips for Better Results
Works well:
- Abstract concepts
- Illustrations and flat design (Mystic model)
- Landscapes and architecture
- Technology imagery
Works less well:
- Text in images (often garbled)
- Specific human faces
- Highly detailed diagrams
Pro tip: Anti-text
In the latest version (v1.1.1), I added automatic “no text, no letters, no words” instruction to prompts — this significantly improved results.
Summary
Problem: Spending 30+ minutes finding illustrations for each post
Solution: WordPress plugin + Freepik API + Claude Code
Result:
- Generation in 10-30 seconds
- 6 AI models + 4 output formats (WebP/AVIF/JPEG/PNG)
- Consistent style per category
- $5 free to start (100-250 images)
- Full control via settings
Links
- GitHub: github.com/nesmachny/freepik-featured-image-generator
- Freepik API: freepik.com/api ($5 free credit on signup)
- Claude Code: claude.ai
Do you use AI for image generation? What tools work best for you? Drop a comment or reach out on Telegram.



