Automated Content Generation Workflow: Building a Content Production Pipeline with AI API

Β·5 min readΒ·168 views
```html

Automated Content Generation

Writing articles manually is too inefficient? By building an automated content generation pipeline using AI APIs, you can boost content output efficiency by more than 10x. This article will introduce how to set up a complete automated content production system.


Why Automate Content?

Content creation faces several core challenges:

  • High output demand: SEO requires continuous updates, social media needs daily posts
  • High labor costs: A full-time writer can produce at most 2-3 high-quality articles per day
  • Unstable quality: Fluctuations in human state affect content quality
  • Multi-platform distribution: The same content needs to adapt to different platform format requirements

AI APIs can solve these problems: batch generation, stable quality, flexible formats, controllable costs.


Content Generation Pipeline

Generation Pipeline

A complete content generation pipeline includes the following stages:

StageInputOutput
Topic PlanningKeywords / TrendsArticle topic list
Outline GenerationArticle topicStructured outline
Content WritingOutline + Reference materialsComplete article
Quality ReviewDraftOptimized article
Format AdaptationStandard articleMulti-platform formats

Code Implementation

1. Topic Planning

from openai import OpenAI

client = OpenAI(
    base_url="https://www.ciyuano.com/v1",
    api_key=***
)

def generate_topics(keyword: str, count: int = 10) -> list:
    """Generate a list of article topics based on the keyword"""
    response = client.chat.completions.create(
        model="deepseek-v4",
        messages=[{
            "role": "user",
            "content": f"Generate {count} article titles around the topic γ€Œ{keyword}」. Requirements: eye-catching, SEO-friendly, Chinese. Return the title list directly, one per line."
        }],
        temperature=0.8
    )
    return response.choices[0].message.content.strip().split("\n")

2. Outline Generation

def generate_outline(title: str) -> str:
    """Generate an article outline based on the title"""
    response = client.chat.completions.create(
        model="deepseek-v4",
        messages=[{
            "role": "user",
            "content": f"Generate a detailed outline for the following article: γ€Œ{title}」. Requirements: include 5-7 main sections, each with 2-3 key points. Output in Markdown format."
        }],
        temperature=0.5
    )
    return response.choices[0].message.content

3. Content Writing

def write_article(title: str, outline: str) -> str:
    """Write a complete article based on the outline"""
    response = client.chat.completions.create(
        model="deepseek-v4",
        messages=[
            {
                "role": "system",
                "content": "You are a professional technical blog writer. Writing style: concise and professional, clear logic, with practical examples."
            },
            {
                "role": "user",
                "content": f"Write a complete article based on the following outline.\n\nTitle: {title}\n\nOutline: {outline}\n\nRequirements: 1500-2500 characters, Chinese, use Markdown format."
            }
        ],
        temperature=0.7,
        max_tokens=4000
    )
    return response.choices[0].message.content

4. Quality Review

def review_article(article: str) -> dict:
    """AI self-review of article quality"""
    response = client.chat.completions.create(
        model="deepseek-v4",
        messages=[{
            "role": "user",
            "content": f"Please review the following article, provide a score and improvement suggestions.\n\n{article}\n\nReturn in JSON format: {{\"score\": 1-10, \"issues\": [...], \"suggestions\": [...]}}"
        }],
        temperature=0.3
    )
    return response.choices[0].message.content

Batch Generation

Combine the above steps into a complete batch generation process:

import asyncio
import json

async def batch_generate(keyword: str, count: int = 5):
    """Batch generate articles"""
    # 1. Generate topics
    topics = generate_topics(keyword, count)

    results = []
    for topic in topics:
        # 2. Generate outline
        outline = generate_outline(topic)

        # 3. Write article
        article = write_article(topic, outline)

        # 4. Quality review
        review = review_article(article)
        score = json.loads(review).get("score", 0)

        if score >= 7:
            results.append({
                "title": topic,
                "content": article,
                "score": score
            })
            print(f"[OK] {topic} (Score: {score})")
        else:
            print(f"[SKIP] {topic} (Score: {score}, requires manual review)")

        # Control rate to avoid API throttling
        await asyncio.sleep(2)

    return results

Use Cases

Batch Generation of SEO Articles

Generate optimized articles in batches for long-tail keywords, producing 50+ high-quality pieces per day.

Automatic Product Description Generation

Product descriptions for e-commerce platforms and feature introductions for SaaS products can be auto-generated using templates + AI.

Social Media Content

Generate format-adapted content for different platforms (Weibo, Xiaohongshu, Twitter) β€” input once, distribute to multiple platforms.

Email Marketing

Generate personalized marketing emails based on user personas to improve open rates and conversion rates.


Quality Control Strategies

  • AI self-review: Let AI score itself; content scoring below 7 requires manual review
  • Deduplication check: Compare against existing content library to avoid duplication
  • Fact verification: Content involving data and facts needs human verification
  • SEO optimization: Check keyword density, heading structure, internal link settings
  • Regular spot checks: Randomly sample 10% of content for manual quality assessment

Cost Estimation

StageToken ConsumptionCost per Article
Topic Planning~5000.001 yuan
Outline Generation~8000.001 yuan
Content Writing~40000.006 yuan
Quality Review~20000.003 yuan
Total~7300Approx. 0.01 yuan/article

Using the DeepSeek V4 model, the generation cost per article is about 0.01 yuan, and 50 articles per day costs only 0.5 yuan.


Summary

AI content automation is not about replacing human writing, but about handing over low-value, repetitive content production to AI, allowing humans to focus on creativity and strategy.

Key takeaways:

  1. Pipeline approach: Break down content production into multiple stages, optimize each independently
  2. Quality control: AI self-review + manual spot checks to ensure content quality
  3. Cost management: Choose the right model and control token consumption
  4. Continuous iteration: Continuously optimize generation strategies based on data feedback

Get started now: Register for Ciyuan Circle, get your API Key, and build your content automation pipeline.

Register account Β· API docs Β· Choose model

```

Comments are not yet available, stay tuned