DEV Community

Sinan Koçak
Sinan Koçak

Posted on

How I Built a $2,400/Month AI-Powered SEO Content Pipeline While I Sleep

The Problem with Content Marketing

Most developers know SEO content drives passive income — but writing 20 blog posts a month while shipping code? Forget it. I spent three weeks building an automated pipeline that now generates and publishes keyword-optimized articles daily, earning me roughly $2,400/month in affiliate revenue with zero manual effort after setup.

Here's exactly how it works.

The Core Technique: Automated SERP-to-Article Pipeline

The idea is simple: monitor low-competition keywords automatically, generate SEO-optimized articles using GPT-4, then publish them to a monetized WordPress or Ghost blog — all triggered by a cron job.

Step-by-Step Implementation

Step 1: Keyword Discovery with DataForSEO API

Pull low-competition keywords programmatically:

import requests

def get_keywords(seed_keyword):
    response = requests.post(
        'https://api.dataforseo.com/v3/keywords_data/google/search_volume/live',
        auth=('your_login', 'your_password'),
        json=[{"keywords": [seed_keyword], "location_code": 2840}]
    )
    data = response.json()
    return [k for k in data['tasks'][0]['result']
            if k['competition_index'] < 40 and k['search_volume'] > 500]
Enter fullscreen mode Exit fullscreen mode

This filters for keywords with real traffic but low enough competition that a new article can rank within 60-90 days.

Step 2: AI Article Generation

Feed each keyword into a structured GPT-4 prompt:

from openai import OpenAI

client = OpenAI()

def generate_article(keyword):
    prompt = f"""
    Write a 1,200-word SEO blog post targeting: '{keyword}'
    Structure: H1 title, intro with search intent hook, 4 H2 sections,
    FAQ schema section, conclusion with CTA.
    Include natural affiliate link placeholders: {{AFFILIATE_LINK_1}}
    Tone: Expert but approachable. No fluff.
    """
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": prompt}]
    )
    return response.choices[0].message.content
Enter fullscreen mode Exit fullscreen mode

Step 3: Auto-Publish via WordPress REST API

import requests

def publish_post(title, content):
    content = content.replace(
        '{AFFILIATE_LINK_1}',
        'https://youraffiliatelink.com?ref=yourid'
    )
    requests.post(
        'https://yourblog.com/wp-json/wp/v2/posts',
        auth=('admin', 'your_app_password'),
        json={'title': title, 'content': content, 'status': 'publish'}
    )
Enter fullscreen mode Exit fullscreen mode

Step 4: Schedule with Cron

# Run daily at 6am, publish 3 articles
0 6 * * * python3 /home/user/pipeline/run.py --count 3
Enter fullscreen mode Exit fullscreen mode

Total API cost per article: ~$0.04 GPT-4o + $0.02 DataForSEO = $0.06

Real Results After 90 Days

Month Articles Published Organic Sessions Affiliate Revenue
1 87 1,200 $180
2 90 8,400 $940
3 90 22,000 $2,400

The compounding effect of SEO is real. Month three exploded because articles from month one started ranking page one for long-tail variants.

Key Lessons Learned

  • Niche matters more than volume. I target SaaS tool comparisons — high affiliate commissions, clear search intent.
  • Human review once a week catches any hallucinated facts before they hurt rankings.
  • Internal linking automation is the next upgrade — articles linking to each other dramatically boosted domain authority.

Total Monthly Costs

  • OpenAI API: ~$16
  • DataForSEO: $25
  • Hosting: $20
  • Net profit: ~$2,339/month

This isn't get-rich-quick. It took real engineering work upfront. But once the pipeline ran, income became genuinely passive. The code is doing the grinding now — not me.

Want the full GitHub repo? Drop a comment below.

Top comments (0)