# AI Content Writer (`erinle_sam/ai-content-writer`) Actor

Automatically research and write high-quality articles using AI. Searches Google, extracts content from 12+ sources, and generates human-like articles in 7 languages. Multiple formats (MD, DOCX, HTML) and templates available. Two-pass AI ensures natural writing.

- **URL**: https://apify.com/erinle\_sam/ai-content-writer.md
- **Developed by:** [Erinle Samuel](https://apify.com/erinle_sam) (community)
- **Categories:** AI, Automation, Agents
- **Stats:** 30 total users, 1 monthly users, 100.0% runs succeeded, 4 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $400.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## AI Content Writer

AI Content Writer is an [Apify Actor](https://docs.apify.com/platform/actors) that automatically researches, writes, and formats high-quality articles using artificial intelligence. The Actor intelligently combines web research with advanced AI to create well-informed, engaging content in multiple languages and formats.

Built specifically for content creators, marketers, and publishers, AI Content Writer handles the entire article creation pipeline—from researching relevant sources to generating polished final drafts—allowing you to scale your content production without sacrificing quality.

**No setup required** - Just provide your topic and the Actor handles everything: AI model selection, web scraping, and content generation are all managed automatically.

### Main features

AI Content Writer is built on the [Apify platform](https://apify.com) and leverages OpenAI's GPT models for intelligent content generation. The Actor can:

- **Conduct intelligent web research** using Google Search and extract content from up to 12 articles
- **Write in 7 languages**: English, French, Portuguese, German, Italian, Dutch/Flemish, and Russian
- **Generate multiple article types**: blog posts, tutorials, listicles, how-to guides, thought leadership pieces, guest articles, and news reports
- **Filter low-quality content** automatically by detecting paywalls and spam articles
- **Apply two-pass generation** with initial draft and humanization refinement for natural-sounding content
- **Export to multiple formats**: Markdown, Microsoft Word (.docx), and HTML
- **Inject custom context** to guide article generation with your own research materials or guidelines
- **Scale efficiently** with transparent pay-per-event pricing based on actual word count
- **Integrate seamlessly** with Apify workflows, schedulers, and webhooks

Learn about the key features and capabilities in the **AI Content Writer Overview** video:

> 📺 *Video tutorial coming soon!*

Still unsure if AI Content Writer can handle your use case? Simply try it for free and see the results for yourself.

### How it works

AI Content Writer operates in six distinct stages:

1. **Google Search** - Searches Google (always in English for best results) for relevant articles based on your topic
2. **Website Crawling** - Extracts full text content from discovered URLs using Apify's Website Content Crawler
3. **Content Filtering** - Automatically filters out paywalled content and spam articles (under 200 words)
4. **Draft Generation** - Creates initial article draft using AI with all researched content and optional user context
5. **Humanization** - Refines the draft with higher creativity to make it sound natural and engaging
6. **Formatting** - Converts final article to Markdown and/or Microsoft Word document

The Actor provides detailed progress tracking at each stage, saving intermediate results to the dataset so you can monitor the research and writing process in real-time.

#### Research Phase

The Actor begins by searching Google for articles related to your topic. Using the [apify/google-search-scraper](https://apify.com/apify/google-search-scraper), it queries Google with your topic and discovers up to 12 relevant URLs. The search is always performed in English to ensure the best quality results, regardless of your target language.

Once URLs are discovered, the Actor uses [apify/website-content-crawler](https://apify.com/apify/website-content-crawler) to extract the full text content from each page. This crawler uses adaptive crawling technology to handle both static and dynamic websites effectively.

#### Content Filtering

Not all discovered content is suitable for research. The Actor automatically filters out:

- **Paywalled articles**: Pages containing keywords like "subscribe", "premium", "login", or "paywall"
- **Spam or thin content**: Articles with fewer than 200 words
- **Duplicate content**: Pages with the same canonical URL

This ensures your article is based only on high-quality, accessible sources.

#### AI Generation

The Actor uses OpenAI's GPT models (gpt-4.1 or gpt-4o-mini) in a two-pass approach:

**First Pass (Draft)**: The AI generates an initial article following your chosen template structure. It synthesizes information from all filtered sources, incorporates your optional user context, and writes in your target language with the specified tone and word count.

**Second Pass (Humanization)**: The AI refines the draft with higher temperature (creativity) settings to make the writing more natural, varied, and engaging. It removes AI-like patterns, varies sentence structure, adds transitional phrases, and ensures the content sounds authentically human-written.

#### Output Generation

Finally, the Actor formats your article into the requested output formats:

- **Markdown**: Clean, portable text format perfect for CMS platforms and static site generators
- **Microsoft Word (.docx)**: Professional document format ready for editing and distribution
- **HTML**: Web-ready format (available in the output data)

All outputs include metadata such as word count, reading time, and source citations.

### Designed for content professionals

AI Content Writer helps content creators, marketers, and publishers scale their content production while maintaining quality and authenticity.

**Multi-language content creation**

Expand your reach internationally by generating articles in 7 different languages. The Actor performs research in English (for best results) but writes the final article in your target language, ensuring accurate and natural-sounding content for each market.

**Guest blogging and thought leadership**

Use the guest article and thought leadership templates to create professional contributions for external publications. These templates emphasize credibility establishment, unique insights, and actionable value—perfect for building your brand authority.

**News coverage and trending topics**

Generate timely news articles with the news report template, which follows journalistic standards including headline, lead paragraph with the 5 W's, background context, key details, and analysis.

**Educational content at scale**

Create comprehensive tutorials, how-to guides, and listicles to educate your audience. The Actor's research capabilities ensure your educational content is well-informed and up-to-date.

### Input

AI Content Writer requires minimal input to get started. The only mandatory field is your article topic—all other settings have sensible defaults.

For a complete description of all settings, see the [Input tab](https://apify.com/your-username/ai-article-writer/input-schema).

#### Required fields

#### Required fields

- **`topic`** (string) - The article topic you want to write about (e.g., "The Future of AI in Healthcare")

That's it! All other fields are optional with intelligent defaults.

#### Optional fields

- **`language`** (string) - Target language for the article. Options: `english` (default), `french`, `portuguese`, `german`, `italian`, `dutch`, or `russian`. Research is always conducted in English for better results, but the final article will be written in your chosen language.

- **`writingTemplate`** (string) - Article structure and style. Options: `blog-post` (default), `tutorial`, `listicle`, `how-to-guide`, `thought-leadership`, `guest-article`, or `news-report`. Each template has a unique structure optimized for its purpose.

- **`userContext`** (string) - Optional context, guidelines, or research materials to inform the article. Use this to inject your own insights, specific requirements, or additional information that should guide the AI's writing. Maximum 5,000 characters.

- **`targetAudience`** (string) - Who the article is written for (e.g., "developers", "beginners", "business executives", "general public"). Default: "general tech audience". Maximum 200 characters.

- **`tone`** (string) - Writing tone and style. Options: `professional` (default), `casual`, `technical`, `conversational`, `academic`, or `persuasive`.

- **`wordCount`** (integer) - Target article length in words. Minimum: 300, Maximum: 5,000, Default: 1,500. Note that the actual output may vary slightly based on the AI's interpretation.

- **`quality`** (string) - Article quality tier that determines which AI model is used. Options: `standard` (default) or `premium`. See [Quality Tiers](#quality-tiers) section below for details.

### Quality Tiers

AI Content Writer offers two quality tiers, each using a different OpenAI model to generate your articles:

#### Standard (Free for all users)

- **Model**: GPT-4o-mini
- **Access**: Available to all users (free and paid)
- **Best for**: General articles, blog posts, tutorials, and everyday content
- **Speed**: Fast generation time
- **Cost**: Lower pricing tier
- **Quality**: High quality suitable for most content needs

#### Premium (Paid subscription required)

- **Model**: gpt-4.1 (OpenAI's most capable model)
- **Access**: Requires a paid Apify subscription
- **Best for**: High-quality articles, thought leadership, professional content, complex topics
- **Speed**: Moderate generation time
- **Cost**: Higher pricing tier (~2x Standard)
- **Quality**: Exceptional quality with advanced reasoning and nuanced writing

**Payment gating**: If you select `premium` quality without a paid subscription, the Actor will return an error asking you to upgrade your plan or select the `standard` quality tier.

#### Advanced settings

All advanced settings have been optimized with defaults that work well for most use cases:

- Research always scrapes a maximum of 12 articles for comprehensive coverage
- Output is always generated in both Markdown and Microsoft Word formats
- Citations are always included by default

#### Example input

Here's a minimal input example:

```json
{
    "topic": "The Future of Artificial Intelligence in Healthcare"
}
```

And here's a complete example with all optional fields:

```json
{
    "topic": "The Future of Artificial Intelligence in Healthcare",
    "language": "english",
    "writingTemplate": "thought-leadership",
    "quality": "premium",
    "userContext": "Focus on diagnostic AI and patient outcomes. Emphasize the importance of FDA regulations and ethical considerations. Include recent breakthroughs in radiology AI.",
    "targetAudience": "healthcare professionals and hospital administrators",
    "tone": "professional",
    "wordCount": 2500
}
```

### Output

The Actor stores its results in the default [dataset](https://docs.apify.com/platform/storage/dataset) associated with the Actor run, from which you can export them to various formats such as JSON, XML, CSV, or Excel.

For each article generation run, the dataset will contain multiple progress records showing each stage of the pipeline, culminating in a final result record.

#### Progress tracking

The Actor saves progress at each stage:

1. **Google Search (15% progress)**: URLs discovered and search queries used
2. **Website Crawl (35% progress)**: Number of articles crawled and source URLs
3. **Content Filtering (45% progress)**: Count of valid vs rejected articles with rejection reasons
4. **Article Draft (65% progress)**: Draft title, word count, and language (marked as internal)
5. **Article Final (85% progress)**: Final article title, word count, and language
6. **Complete (100% progress)**: Full article data with all outputs and metadata

#### Final output structure

The final record in the dataset contains the complete article information:

```json
{
    "stage": "complete",
    "progress": 100,
    "timestamp": "2025-11-26T10:30:00.000Z",
    "success": true,
    "topic": "The Future of AI in Healthcare",
    "article": {
        "title": "How AI is Revolutionizing Healthcare: From Diagnosis to Treatment",
        "wordCount": 2147,
        "language": "english"
    },
    "outputs": {
        "markdown": {
            "content": "# How AI is Revolutionizing Healthcare...",
            "length": 15234
        },
        "docx": {
            "key": "article.docx",
            "url": "https://api.apify.com/v2/key-value-stores/xyz/records/article.docx"
        }
    },
    "sources": [
        "https://www.nature.com/articles/d41586-019-03847-z",
        "https://www.nejm.org/doi/full/10.1056/NEJMra1814259",
        "https://jamanetwork.com/journals/jama/article-abstract/2762694"
    ]
}
```

#### Key-Value Store

In addition to the dataset, the Actor saves files to the Key-Value Store:

- **`OUTPUT`** - Complete article record including full content text (same as final dataset record plus `fullContent` field)
- **`article.docx`** - Microsoft Word document (if format includes docx)

You can download these files directly from the Actor run's Key-Value Store tab or access them programmatically via the Apify API.

### Writing Templates

AI Content Writer provides seven professionally-designed article templates, each optimized for a specific content type:

#### Blog Post (default)

Standard blog article structure suitable for most topics.

**Structure:**

- Introduction
- Background/Context
- Main Points (2-3 sections)
- Practical Applications
- Conclusion

**Best for:** General-purpose articles, company blogs, opinion pieces, explainers

#### Tutorial

Step-by-step educational content with a learning focus.

**Structure:**

- Introduction & Learning Objectives
- Prerequisites
- Setup/Installation
- Step-by-Step Walkthrough
- Troubleshooting
- Next Steps

**Best for:** Technical guides, software tutorials, skill development content

#### Listicle

Numbered list format with explanations for each item.

**Structure:**

- Introduction
- List Items (numbered with descriptions)
- Honorable Mentions
- Conclusion

**Best for:** "Top 10" articles, comparison lists, resource collections

#### How-to Guide

Problem-solution format with clear, actionable steps.

**Structure:**

- Problem Introduction
- What You'll Need
- Step-by-Step Instructions (numbered)
- Tips & Best Practices
- Conclusion

**Best for:** Task-focused guides, instructional content, practical solutions

#### Thought Leadership

Opinion and analysis piece showcasing expertise and unique perspectives.

**Structure:**

- Context & Current State
- Unique Perspective/Thesis
- Supporting Arguments
- Implications & Impact
- Future Outlook
- Call to Action

**Best for:** Industry analysis, opinion pieces, strategic insights, executive content

#### Guest Article

Professional contribution for external publications.

**Structure:**

- Introduction & Credibility
- Industry Insights
- Case Studies/Examples
- Practical Takeaways
- Conclusion & Bio

**Best for:** Guest posts, external contributions, brand building content

#### News Report

Journalistic news article following standard news writing conventions.

**Structure:**

- Headline/Hook
- Lead Paragraph (5 W's: Who, What, When, Where, Why)
- Background/Context
- Key Details & Timeline
- Quotes & Analysis
- Impact & What's Next

**Best for:** News coverage, press releases, trend reports, timely updates

### Example

This example shows how to generate a comprehensive article about artificial intelligence in healthcare:

#### Input

![AI Content Writer Input Example](https://via.placeholder.com/800x500?text=Input+Example)

```json
{
    "topic": "Artificial Intelligence in Healthcare: Benefits and Challenges",
    "language": "english",
    "writingTemplate": "thought-leadership",
    "userContext": "Focus on real-world implementations. Mention Mayo Clinic's AI radiology system and IBM Watson's oncology applications. Address concerns about algorithmic bias and patient privacy.",
    "targetAudience": "healthcare executives and policy makers",
    "tone": "professional",
    "wordCount": 2000
}
```

[See full input schema](https://apify.com/your-username/ai-article-writer/input-schema)

#### Output

This is how the generated article appears in the dataset (preview of JSON format):

```json
{
    "stage": "complete",
    "progress": 100,
    "success": true,
    "article": {
        "title": "AI in Healthcare: Navigating the Promise and Pitfalls of Medical Innovation",
        "wordCount": 2143,
        "readingTime": 11,
        "language": "english"
    },
    "outputs": {
        "markdown": {
            "content": "# AI in Healthcare: Navigating the Promise and Pitfalls...",
            "length": 18542
        },
        "docx": {
            "key": "article.docx",
            "url": "https://api.apify.com/v2/key-value-stores/.../article.docx"
        }
    },
    "sources": ["https://www.nature.com/...", "https://www.nejm.org/...", "https://jamanetwork.com/..."]
}
```

You can download the article as:

- **JSON** - Structured data with metadata
- **Markdown (.md)** - Clean text format
- **Microsoft Word (.docx)** - Editable document
- **CSV/Excel** - Tabular data export

### How much does it cost?

AI Content Writer uses a pay-per-event pricing model. You only pay for specific events that occur during article generation, not for compute time or platform usage. This makes costs transparent and predictable.

The exact price depends on two factors:

1. **Article word count** - Longer articles require more AI generation time
2. **Quality tier** - Higher quality tiers use more advanced (and expensive) AI models

#### Base Costs (all quality tiers)

| Event           | Description                          | Price |
| --------------- | ------------------------------------ | ----- |
| `GOOGLE_SEARCH` | Search Google for relevant articles  | $0.01 |
| `WEBSITE_CRAWL` | Crawl websites for full text content | $0.01 |
| Base fees       | Start + completion                   | $0.41 |

#### Generation Costs by Quality Tier

**Standard Quality (gpt-4o-mini) - Free for all users:**

| Event                  | Description                            | Price |
| ---------------------- | -------------------------------------- | ----- |
| `ARTICLE_DRAFT_SMALL`  | Draft generation (0-1,000 words)       | $0.30 |
| `ARTICLE_DRAFT_MEDIUM` | Draft generation (1,001-2,000 words)   | $0.45 |
| `ARTICLE_DRAFT_LARGE`  | Draft generation (2,001-3,000 words)   | $0.60 |
| `ARTICLE_DRAFT_XLARGE` | Draft generation (3,001+ words)        | $0.75 |
| `ARTICLE_FINAL_SMALL`  | Final humanization (0-1,000 words)     | $0.20 |
| `ARTICLE_FINAL_MEDIUM` | Final humanization (1,001-2,000 words) | $0.35 |
| `ARTICLE_FINAL_LARGE`  | Final humanization (2,001-3,000 words) | $0.50 |
| `ARTICLE_FINAL_XLARGE` | Final humanization (3,001+ words)      | $0.65 |

**Premium Quality (gpt-4.1) - Paid subscription required:**

Approximately **2x** the Standard quality prices for generation events.

#### Example Costs

**Standard Quality, 2,000-word article:**

- $0.01 (search) + $0.01 (crawl) + $0.45 (draft) + $0.35 (final) + $0.41 (base/completion) = **$1.23**

**Premium Quality, 2,000-word article:**

- $0.01 (search) + $0.01 (crawl) + $0.90 (draft) + $0.70 (final) + $0.41 (base/completion) = **$2.03**

**Premium Quality, 1,000-word article:**

- $0.01 (search) + $0.01 (crawl) + $0.60 (draft) + $0.40 (final) + $0.41 (base/completion) = **$1.43**

*Pricing configured in `.actor/pay_per_event.json`*

#### Performance Optimization

**Batch processing**: AI Content Writer automatically processes all research URLs in a single batch operation (up to 12 articles at once) instead of making individual requests. This follows Apify's best practices for cost efficiency and performance:

- Reuses browser/HTTP instances across multiple pages
- Reduces Actor startup/teardown overhead
- Minimizes redundant proxy and network requests

This batch optimization is built-in and requires no configuration.

### Use Cases

- **Content Marketing**: Generate blog posts and thought leadership pieces in multiple languages
- **Guest Blogging**: Create professional guest articles with proper structure and credibility
- **News Coverage**: Generate news reports following journalistic standards
- **Tutorials & Guides**: Create step-by-step educational content for your audience
- **Multi-Language Content**: Expand your reach with articles in 7 languages
- **Research-Based Writing**: Leverage real web content to create well-informed articles
- **Research Summaries**: Analyze multiple sources and synthesize findings
- **Educational Content**: Build tutorials, how-to guides, and explainer articles
- **News Articles**: Stay current with AI-generated news and trend analysis
- **Documentation**: Generate technical documentation and user guides

### Troubleshooting

#### Common Issues

**"No content was crawled" or "0 articles crawled"**

- Try a different, more popular topic with broader keywords
- Some websites may be blocking automated crawlers
- Check if the topic is too niche or has limited online coverage

**"Content Filtering - All articles were filtered out"**

- Most articles found were behind paywalls or too short
- Try a different topic that has more freely accessible content
- This can happen with very specialized or academic topics

**"Memory limit exceeded" errors**

- The Actor is using the optimized Cheerio crawler for efficiency
- If you continue to see this error, contact support
- Consider running the Actor during off-peak hours

**Article quality issues or AI-like patterns**

- Try using the **Premium quality** tier for better results (requires paid subscription)
- Provide more specific user context to guide the AI
- Adjust the tone and target audience settings
- The Actor now includes improved anti-AI pattern guidelines

**Output files not showing proper formatting**

- Download the DOCX or HTML files from the Key-Value Store
- The markdown output will contain formatting codes - this is normal
- DOCX and HTML files have proper formatting applied

**Empty or missing output**

- Check Actor logs in the run details page for specific errors
- Ensure you have sufficient Apify credits for the run
- Verify the topic is valid and has searchable content

### Integration & Automation

#### Run via API

You can integrate AI Content Writer into your workflows using the Apify API:

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('YOUR_USERNAME/ai-article-writer').call({
    topic: 'The Future of Renewable Energy',
    language: 'english',
    quality: 'premium',
    wordCount: 2000,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Schedule Regular Content

Use Apify's [Scheduler](https://docs.apify.com/platform/schedules) to automatically generate articles on a regular basis:

1. Go to your Actor's run page
2. Click "Schedule"
3. Set your desired frequency (daily, weekly, etc.)
4. Configure the input for each scheduled run

#### Webhooks

Set up [webhooks](https://docs.apify.com/platform/integrations/webhooks) to trigger actions when articles are completed:

- Post articles directly to your CMS
- Send notifications to your team
- Trigger additional processing workflows

### Resources

- [Apify Platform Documentation](https://docs.apify.com)
- [Actor Input Schema](https://apify.com/YOUR_USERNAME/ai-article-writer/input-schema)
- [Apify API Reference](https://docs.apify.com/api/v2)
- [Pricing & Billing](https://docs.apify.com/platform/actors/running/usage-and-resources)
- [Webhooks Guide](https://docs.apify.com/platform/integrations/webhooks)
- [Scheduling Guide](https://docs.apify.com/platform/schedules)

### Support

If you have any questions or need assistance:

- Check the [Apify Forum](https://forum.apify.com/)
- Contact support through the Apify Console
- Review the Actor logs for detailed error messages

### License

Apache-2.0

***

**Built with ❤️ using Apify, Mastra AI, and OpenAI GPT**

Ready to scale your content production? [Try AI Content Writer now!](https://console.apify.com/actors)

# Actor input Schema

## `topic` (type: `string`):

The topic you want to write about.

## `language` (type: `string`):

The language in which the article will be written. Research is always conducted in English for better results.

## `writingTemplate` (type: `string`):

The structure/template for the article.

## `userContext` (type: `string`):

Optional context, guidelines, or research materials to inform the article.

## `targetAudience` (type: `string`):

Who is this article for? (e.g., 'beginners', 'developers', 'business executives', 'general public')

## `tone` (type: `string`):

The tone and style of the article.

## `wordCount` (type: `integer`):

Approximate length of the article in words.

## `quality` (type: `string`):

Quality tier determines the AI model used. Standard (gpt-4o-mini) is free for all users. Premium (gpt-4.1) requires a paid subscription.

## Actor input object example

```json
{
  "topic": "The Future of AI Agents in Web Development",
  "language": "english",
  "writingTemplate": "blog-post",
  "targetAudience": "developers",
  "tone": "professional",
  "wordCount": 1500,
  "quality": "standard"
}
```

# Actor output Schema

## `article` (type: `string`):

View the generated article online

## `downloadDocx` (type: `string`):

Download the article as a DOCX file

## `fullOutput` (type: `string`):

Complete article data including markdown content

## `dataset` (type: `string`):

View detailed processing stages and metadata

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "topic": "The Future of AI Agents in Web Development",
    "language": "english",
    "writingTemplate": "blog-post",
    "userContext": "",
    "targetAudience": "developers",
    "tone": "professional",
    "wordCount": 1500,
    "quality": "standard"
};

// Run the Actor and wait for it to finish
const run = await client.actor("erinle_sam/ai-content-writer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "topic": "The Future of AI Agents in Web Development",
    "language": "english",
    "writingTemplate": "blog-post",
    "userContext": "",
    "targetAudience": "developers",
    "tone": "professional",
    "wordCount": 1500,
    "quality": "standard",
}

# Run the Actor and wait for it to finish
run = client.actor("erinle_sam/ai-content-writer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "topic": "The Future of AI Agents in Web Development",
  "language": "english",
  "writingTemplate": "blog-post",
  "userContext": "",
  "targetAudience": "developers",
  "tone": "professional",
  "wordCount": 1500,
  "quality": "standard"
}' |
apify call erinle_sam/ai-content-writer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,erinle_sam/ai-content-writer"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/G5mcos0corjVsuUk4/builds/PtKTCa91G6eUmbigx/openapi.json
