Skip to main content
AIGetFree
Start reading →

Build an AI Content Machine With n8n + OpenRouter + WordPress: Auto-Blog in 2026

July 11, 2026 · Guides & Tutorials
The AI Content Machine: n8n + OpenRouter + WordPress
⚖️ Affiliate Disclosure: This tutorial contains affiliate links to OpenRouter (20% recurring commission, 90-day cookie) and n8n Cloud (30% commission for 12 months). Leonardo AI, Ideogram, and WordPress are mentioned because they're genuinely the best tools — no affiliate relationship. All pricing, architecture decisions, and model recommendations reflect what's actually used in production.
Build Guide · n8n + OpenRouter + WordPress

The AI Content Machine: 300 Articles a Month for Under $50

Here's the problem with AI content tools in 2026: they're either too expensive, too locked-in, or too dumb. ChatGPT Plus costs $20/month and gives you one model. Jasper costs $49/month and still writes like a robot. Zapier charges per task and breaks when you scale.

This tutorial builds something different: a multi-model content engine that uses the right AI for each task, runs on infrastructure you control, and costs under $25/month for 300 fully illustrated, SEO-optimized articles.

The key insight: you don't need one AI for everything. You need a cheap fast model for classification, a smart expensive model for writing, and a structured model for SEO metadata. OpenRouter lets you mix all three through a single API key. n8n wires them together. WordPress publishes the result.

🛠️ The 3 Tools You Need

⚙️
n8n Community Edition
Self-hosted visual workflow automation. 400+ integrations, native AI agent nodes, unlimited executions. Runs via Docker on any VPS, homelab, or Raspberry Pi. This is the orchestration layer.
✓ Free ForeverOpen SourceDocker
🔀
OpenRouter
Unified API gateway for 300+ AI models. One base URL, one credit balance, unlimited model switching. Passthrough pricing with a flat 5.5% credit fee. 26 completely free models for prototyping.
26 Free Models5.5% Fee OnlyOpenAI-Compatible
📝
WordPress
The publishing destination. REST API enabled by default. n8n's WordPress node creates posts, sets categories/tags, uploads featured images, and writes SEO metadata (Rank Math/Yoast) automatically.
✓ Free (Self-Hosted)REST APIAny WP Site
💡

Optional: Leonardo AI (~$14/month) for AI-generated featured images (300 images/month), or Ideogram (10 free/day) for text-in-image graphics. Both integrate via HTTP Request nodes in n8n.

🏗️ The Architecture: How the Workflow Thinks

A multi-stage content engine with quality gates at each step. Each node uses the optimal model for its specific task — not one model for everything.

Step 1
⏰ Schedule Trigger
Fires daily at 6:00 AM. Kicks off the entire pipeline automatically.
Step 2
📡 RSS Feed Fetch
Pulls 20 items each from TechCrunch, Wired, Hacker News, Ars Technica. ~80 candidate articles per run.
Step 3
🔍 AI Classifier
Filters articles by niche relevance. Returns JSON with confidence score.Gemini 2.5 Flash — $0.30/$2.50 per M tokens
Step 4
🔬 AI Researcher
Synthesizes key facts, supporting data, and context for the topic.Claude Sonnet 4.6 — $3/$15 per M tokens
Step 5
📋 AI Outliner
Generates 5 SEO title ideas, picks the best, creates H2 outline structure.GPT-4.1 — $2/$8 per M tokens
Step 6
✍️ AI Writer
Writes 1,200-word article from outline with citations and natural prose.Claude Sonnet 4.6 — $3/$15 per M tokens
Step 7
🎯 AI SEO Optimizer
Generates meta title, meta description, slug, alt text, tags, focus keyword.GPT-4.1 — $2/$8 per M tokens
Step 8
🖼️ Image Generator
Creates featured image matching article theme via Leonardo AI API.Leonardo AI — ~$0.046/image
Step 9
📤 WordPress Publisher
Creates post with content, metadata, featured image, categories. Status: draft for review.WordPress REST API — Free
Step 10
📊 Logger
Appends row to Google Sheets: title, URL, model used, token cost, timestamp.Google Sheets API — Free

🧠 Model Selection Strategy: Why OpenRouter Wins

This is the key insight. You're not stuck with one AI for every step. Different tasks need different models at different price points. Here's the exact stack:

TaskModelInput (per M)Output (per M)Why This Model
ClassificationGemini 2.5 Flash$0.30$2.50Fast, cheap, accurate for binary decisions
Research + WritingClaude Sonnet 4.6$3.00$15.00Best long-form prose quality in 2026
Outlining + SEOGPT-4.1$2.00$8.00Excellent structured output, JSON-reliable
Fallback (any step)Llama 4 Maverick$0.15$0.60Ultra-cheap, surprisingly capable
Free Tier OptionLlama 3.3 70B$0.00$0.00Zero cost, quality drops but usable
Free Tier OptionGemma 4 31B$0.00$0.00Google's free open model, solid for outlines
$0.05–0.08
Per article (AI cost) using mixed models
$0.00
Per article using only free models (quality drops)

📋 Step-by-Step Tutorial

1
Prerequisites: Install n8n via Docker

One command. That's it. n8n runs on any Linux VPS, homelab server, or even a Raspberry Pi 4. The AI heavy lifting happens on OpenRouter's servers — your machine just orchestrates.

bash — Install n8n
# Install n8n Community Edition via Docker docker run -d --name n8n --restart always -p 5678:5678 -v n8n_data:/home/node/.n8n -e N8N_BASIC_AUTH_ACTIVE=true -e N8N_BASIC_AUTH_USER=admin -e N8N_BASIC_AUTH_PASSWORD=yourpassword docker.n8n.io/n8nio/n8n # Access n8n at http://your-server-ip:5678 # For production: add Nginx reverse proxy + SSL
💡

Don't want to self-host? n8n Cloud starts at ~$20/month and handles hosting, updates, and SSL for you. Use the n8n affiliate link for 30% commission for 12 months if you recommend it to others.

You also need: OpenRouter account at openrouter.ai (free signup, purchase $5+ in credits, copy your API key) + WordPress Application Password (WP Admin → Users → Profile → Application Passwords → Generate).

2
Set Up Credentials in n8n

Go to n8n → Settings → Credentials → Add Credential. You need three credentials:

n8n Credential Config
── Credential 1: OpenRouter (as OpenAI API) ── Type: OpenAI API Base URL: https://openrouter.ai/api/v1 API Key: sk-or-v1-YOUR_OPENROUTER_KEY ── Credential 2: WordPress ── Type: WordPress API WordPress URL: https://yourdomain.com Username: your_wp_username Password: xxxx xxxx xxxx xxxx xxxx xxxx (Application Password) ── Credential 3: Leonardo AI (optional) ── Type: Header Auth Header Name: Authorization Header Value: Bearer YOUR_LEONARDO_API_KEY
3
Build the Workflow: All 15 Nodes

Create a new workflow in n8n. Add nodes in this order. Each node connects to the next via the output connector.

Node 1
⏰ Schedule Trigger
Mode: Cron. Expression: 0 6 * * * (daily 6 AM)
Node 2
📡 RSS Feed Read
Add 3–5 feeds. Set "Return All Items" = true. Limit: 20 per feed.
Node 3
🔀 Split In Batches
Batch Size: 1. Processes each article individually through the pipeline.
Node 4
OpenRouter → google/gemini-2.5-flash
🔍 AI Classifier
OpenAI Chat Model node. Returns JSON relevance decision.
Node 5
🚦 IF Filter
Condition: {{ $json.relevant === true }}. Only relevant articles proceed.
Node 6
OpenRouter → anthropic/claude-sonnet-4-6
🔬 AI Researcher
Synthesizes key facts and supporting data for the topic.
Node 7
OpenRouter → openai/gpt-4.1
📋 AI Outliner
Generates 5 SEO title ideas, picks best, creates H2 outline.
Node 8
OpenRouter → anthropic/claude-sonnet-4-6
✍️ AI Writer
Writes 1,000–1,500 word article from outline with citations.
Node 9
OpenRouter → openai/gpt-4.1
🎯 SEO Optimizer
Outputs JSON: meta_title, meta_description, slug, tags, focus_keyword, image_prompt.
Node 10
🖼️ Leonardo Generate
HTTP POST to Leonardo API with image_prompt from Node 9.
Node 11
⏳ Wait 30s
Wait node: 30 seconds for Leonardo to finish generating the image.
Node 12
📥 Leonardo Fetch
HTTP GET to retrieve the generated image URL from Leonardo.
Node 13
📤 WordPress Create Post
Creates post with title, content, slug, categories, tags, featured image. Status: draft.
Node 14
🎯 WordPress Update Meta
Updates Rank Math / Yoast SEO fields: meta title, meta description, focus keyword.
Node 15
📊 Google Sheets Log
Appends: title, URL, model used, token cost, timestamp, word count.
4
The System Prompts (Copy-Paste Ready)

These are the exact prompts to paste into each OpenAI Chat Model node. Tune them to your niche.

🔍 Node 4 — Classifier System Prompt (Gemini 2.5 Flash)
You are a content relevance classifier for a blog about AI tools, free AI resources, and AI productivity. Given an article title and description, determine if it's relevant to our niche. Return ONLY valid JSON in this exact format: {"relevant": true/false, "confidence": 0-100, "category": "tools|news|tutorial|other", "reason": "one sentence"} Be strict. Only mark relevant if the article directly covers AI tools, AI productivity, free AI resources, or AI for developers.
🔬 Node 6 — Researcher System Prompt (Claude Sonnet 4.6)
You are an expert AI researcher and technical writer. Given a topic, provide: 1. 5 key facts or statistics about this topic 2. The main technical concepts explained simply 3. Real-world implications for developers and everyday users 4. 2-3 supporting data points or examples 5. Common misconceptions to address Be factual, specific, and cite the type of source (e.g., "according to recent benchmarks"). Do not hallucinate statistics.
📋 Node 7 — Outliner System Prompt (GPT-4.1)
You are an SEO content strategist. Given research notes, create: 1. 5 SEO-optimized title options (include numbers, power words, current year) 2. The BEST title (explain why in one sentence) 3. An H2 outline with 5-7 sections 4. A suggested word count per section Return as JSON: {"titles": [...], "best_title": "...", "best_title_reason": "...", "outline": [{"h2": "...", "words": 200, "key_points": [...]}]}
✍️ Node 8 — Writer System Prompt (Claude Sonnet 4.6)
You are a senior technical writer for AIGetFree.com — a blog about free and affordable AI tools for developers and everyday users. Write in a direct, informed tone. Like a smart friend explaining what actually matters. No fluff, no filler, no "In conclusion" paragraphs. Given an outline and research notes, write a complete 1,200-word article in HTML format using <h2>, <p>, <ul>, <strong> tags. Include: - A compelling intro that hooks the reader in the first sentence - Practical, actionable information in each section - At least one specific example or use case - A clear conclusion with a recommendation Do not include <html>, <head>, or <body> tags. Just the article content.
🎯 Node 9 — SEO Optimizer System Prompt (GPT-4.1)
You are an SEO metadata specialist. Given an article title and content, generate: Return ONLY valid JSON: { "meta_title": "60 chars max, include focus keyword", "meta_description": "155 chars max, compelling, include CTA", "slug": "lowercase-hyphenated-no-stop-words", "focus_keyword": "primary keyword phrase", "tags": ["tag1", "tag2", "tag3", "tag4", "tag5"], "image_prompt": "photorealistic image description for Leonardo AI, 16:9, no text in image" }
5
Test the Pipeline

Click "Test Workflow" in n8n. Watch each node execute in sequence. The full run takes 2–4 minutes per article.

Expected Output in WordPress Drafts
✓ Node 1: Schedule Trigger — fired ✓ Node 2: RSS Feed — 80 items fetched ✓ Node 3: Split — processing item 1/80 ✓ Node 4: Classifier — {"relevant": true, "confidence": 92, "category": "tools"} ✓ Node 5: IF — passed (relevant === true) ✓ Node 6: Researcher — 847 tokens used ✓ Node 7: Outliner — 5 titles generated, outline created ✓ Node 8: Writer — 1,247 words written ✓ Node 9: SEO — meta title, description, slug, tags generated ✓ Node 10: Leonardo — generation job queued (ID: abc123) ✓ Node 11: Wait — 30 seconds ✓ Node 12: Leonardo — image URL retrieved ✓ Node 13: WordPress — post created (ID: 4821, status: draft) ✓ Node 14: WordPress — SEO meta updated (Rank Math) ✓ Node 15: Sheets — row appended Total cost this article: $0.067 | Time: 2m 34s
⚠️

Always review drafts before publishing. Set WordPress post status to draft in Node 13. Review quality, check for hallucinations, add your own commentary. AI writes the first draft — you publish the final version.

💰 Cost Analysis: Our Stack vs. Traditional

ComponentOur StackTraditional AlternativeOur CostTraditional Cost
Automationn8n Community (self-hosted)Zapier Professional$0/mo$19.99+/mo
AI API (writing)OpenRouter (multi-model)ChatGPT Plus + Claude Pro$15–25/mo$40/mo
AI API (images)Leonardo AIMidjourney$14/mo$30/mo
HostingYour VPSCloud-hosted automation$5–10/mo$0 (included)
WordPressSelf-hosted (existing)WordPress.com Business$0/mo$25/mo
TOTALn8n + OpenRouter + LeonardoZapier + ChatGPT + Midjourney$34–49/mo$115+/mo
$0.11–0.16
Per fully illustrated, SEO-optimized article at 300 articles/month

🚀 Advanced Patterns

👤
Human-in-the-Loop Review
Insert a Wait + Slack/Email node after the Writer. Get a Slack DM with the draft. Approve or reject before it publishes. Best of both worlds.
🆚
A/B Model Testing
Duplicate the Writer node — one uses Claude, one uses GPT-4.1. Add an "Editor-in-Chief" AI node that reads both and picks the better version.
🔀
Multi-Niche Routing
Add a Switch node after classification. Route "tools" articles to one prompt set, "news" to another, "tutorials" to a third. Each niche gets optimized prompts.
🔗
Automated Internal Linking
Query WordPress REST API for related posts before the Writer runs. Pass existing post URLs to Claude with instructions to link naturally within the article.
Quality Scoring Gate
Add an "Editor-in-Chief" AI node that scores articles on readability, SEO, and accuracy (0–100). Only publish articles scoring above 75. Reject the rest.
📱
Scheduled Social Promotion
After publishing, generate tweet + LinkedIn variations. Post via Buffer API spaced 6 hours apart. One article → 3 social posts, fully automated.

⚠️ Common Pitfalls & Fixes

🔴 Problem
All articles sound the same
Fix: Rotate 3–5 different writer personas in the system prompt. Add a "persona" field to your Google Sheets log and cycle through: "senior developer," "tech journalist," "skeptical reviewer," etc.
🔴 Problem
AI hallucinates facts
Fix: Add a Web Search tool node before the Writer runs. n8n has a native Brave Search integration. Pass real search results to Claude as context — it can't hallucinate what it can actually read.
🔴 Problem
OpenRouter credit surprises
Fix: Log token usage to Google Sheets after every node. Add an IF node that checks your OpenRouter balance via their API before each run. Pause if balance drops below $2.
🔴 Problem
WordPress rate limits
Fix: Add a 5–10 second Wait node between publishing each article. WordPress REST API has rate limits on shared hosting. Batch publishing 5 articles with 8-second gaps works reliably.
🔴 Problem
Generic featured images
Fix: Make image prompts specific in the SEO Optimizer prompt. Example: "A developer at a desk with three monitors showing code, warm lighting, photorealistic, 16:9, no text." Generic prompts → generic images.
🔴 Problem
n8n workflow crashes silently
Fix: Add an Error Trigger workflow that sends you a Telegram or email notification when any node fails. n8n has a built-in Error Trigger node — use it from day one.

❓ FAQ

Do I need to know how to code to build this?
No. n8n is a visual node editor — you drag, drop, and connect nodes. The "code" in this tutorial is configuration: API keys, system prompts, and JSON field names. If you can follow a recipe, you can build this workflow. The hardest part is the Docker install command, and that's literally one line.
Why OpenRouter instead of using OpenAI or Anthropic directly?
Four reasons: model flexibility (use the best model for each task), no single-provider rate limits, cost optimization (Gemini Flash for classification costs far less than Claude), and future-proofing (swap in a better model without changing your API setup). OpenRouter also has 26 completely free models for prototyping.
How much does OpenRouter actually cost for content automation?
Using the mixed-model stack in this tutorial: $15–25/month for ~300 articles — roughly $0.05–0.08 per article in AI costs. Using only free models: $0 in AI costs, though quality drops noticeably. The 5.5% credit purchase fee is the only fixed cost.
Is AI-generated content penalized by Google in 2026?
No — Google's 2026 stance is clear: quality matters, not origin. Their E-E-A-T guidelines apply equally to human and AI content. What gets penalized: thin content, factual errors, keyword stuffing, and content with no unique value. This is why the pipeline publishes to drafts — review before publishing, add your own commentary, fix any hallucinations.
Can I run this on a Raspberry Pi?
Yes. n8n runs on any Linux system with Docker — including Raspberry Pi 4 (4GB+ RAM recommended). The AI heavy lifting happens on OpenRouter's servers, not your Pi. A $35 Raspberry Pi 4 can handle this workflow indefinitely. For production reliability, a $5–10/month VPS (Hetzner, DigitalOcean) is more stable.
⭐⭐⭐⭐⭐

Final Verdict: Build This Stack

This isn't a theoretical tutorial. It's the exact architecture that produces 300 SEO-optimized articles per month for under $50 total. The model-mixing strategy through OpenRouter is the key insight — stop paying for one expensive model to do everything, and start using the right tool for each job.

✅ n8n: free, powerful, self-hosted
✅ OpenRouter: 300+ models, one key
✅ $0.11–0.16 per full article
✅ Zero manual publishing
✅ Runs on Raspberry Pi or VPS
✅ 26 free models to start
🚀 Get Your OpenRouter API Key →

The Bottom Line

A multi-model content pipeline beats a single subscription every time you need volume: cheap models handle triage, expensive models handle prose, and the whole thing runs unattended on hardware you already own.

Review every draft before it goes live — the automation writes the first pass, you publish the final version.

Best ForBloggers and site owners scaling past 10–20 posts/month
Price$34–49/mo all-in vs. $115+/mo traditional stack
Key StrengthMix-and-match models through one OpenRouter key
VerdictWorth the one-time setup for anyone publishing at volume
Learn More →