# AI Web to Markdown - LLM-Ready Extractor (`wiry_kingdom/ai-web-to-markdown`) Actor

Convert any URL into clean LLM-ready markdown. Strips ads, nav, footer. Preserves headings, lists, tables, code blocks. Returns token count. Perfect for RAG, fine-tuning, AI agents. 10x cheaper than Firecrawl.

- **URL**: https://apify.com/wiry\_kingdom/ai-web-to-markdown.md
- **Developed by:** [Mohieldin Mohamed](https://apify.com/wiry_kingdom) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Web to Markdown — LLM-Ready Content Extractor

**Convert any URL into clean markdown your LLM can actually read. 10x cheaper than Firecrawl, perfect for RAG, fine-tuning, and AI agent context.**

This actor takes a list of URLs, fetches each one, strips out ads / navigation / footers / scripts, extracts the main article content using smart heuristics, and converts the result into beautifully clean markdown that's optimized for LLM consumption. Each output includes a token count so you can budget your context windows precisely.

### What does AI Web to Markdown do?

You point it at any URL — a blog post, a documentation page, a Wikipedia article, a news story, a product page — and it returns:

- The main content as **clean markdown** (headings, lists, tables, code blocks all preserved)
- **YAML frontmatter** with the page's title, description, author, publish date, language, and source URL
- **Word count and estimated token count** so you know exactly how much context window the page will consume

Try it: paste any URL into the **Start URLs** field and press **Start**. Within seconds you get back a structured row that's ready to drop straight into your RAG pipeline, your fine-tuning dataset, or your AI agent's context window.

Apify platform advantages include scheduled runs (re-extract every day to catch updates), API access (pull the dataset directly into your training pipeline), proxy rotation when needed, and parallel extraction of thousands of URLs in one run.

### Why use AI Web to Markdown?

- **Build RAG systems on the cheap.** Firecrawl charges $19+/month for similar functionality. This actor is pay-per-event at $0.005/page — the entire Wikipedia AI articles set costs ~$5.
- **Fine-tune domain-specific LLMs.** Convert thousands of niche-domain articles into clean training data in one batch.
- **Pre-process AI agent context.** Don't waste tokens on ads and nav — feed only the content that matters.
- **Bulk content audit.** Extract every page on a competitor's site and analyze with an LLM.
- **Backup your own content.** Snapshot a website's articles into clean markdown for archival.
- **Migrate from old CMS to new.** Get every blog post out of an old site as portable markdown.

### How to use

1. Click **Try for free** (or **Start**)
2. Paste one or more URLs into **Start URLs**
3. Optionally tweak settings (strip boilerplate, preserve links/images, max length)
4. Click **Start**
5. Download the dataset as JSON, CSV, or Excel — or pull it directly via the Apify API

### Input

- **Start URLs** — one or more URLs to convert (each becomes one dataset row)
- **Strip ads, nav, footer, boilerplate** — recommended on for clean RAG output (default: yes)
- **Preserve links** — keep `[text](url)` markdown links (default: yes)
- **Preserve images** — keep `![alt](url)` references (default: yes)
- **Include metadata** — attach YAML frontmatter (default: yes)
- **Max length** — truncate output to N characters (default: unlimited)
- **Proxy configuration** — optional Apify Proxy for blocked sites

### Output

```json
{
    "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol",
    "sourceUrl": "https://en.wikipedia.org/wiki/Model_Context_Protocol",
    "title": "Model Context Protocol - Wikipedia",
    "description": "An open protocol for connecting AI agents to data sources and tools.",
    "author": null,
    "publishedAt": "2024-11-25T00:00:00Z",
    "siteName": "Wikipedia",
    "language": "en",
    "wordCount": 2147,
    "estimatedTokens": 2580,
    "markdown": "---\nurl: \"https://en.wikipedia.org/...\"\ntitle: \"Model Context Protocol - Wikipedia\"\n---\n\n## Model Context Protocol\n\nThe **Model Context Protocol** (MCP) is an open standard...",
    "extractedAt": "2026-04-15T19:00:00.000Z"
}
````

### Data table

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | The final URL after redirects |
| `sourceUrl` | string | The URL you provided |
| `title` | string | Page title (from `<title>` or OG) |
| `description` | string | Meta description |
| `author` | string | Author from meta tags or microdata |
| `publishedAt` | string | Publication date |
| `siteName` | string | Site name from `og:site_name` |
| `language` | string | Page language code |
| `wordCount` | number | Word count of the markdown output |
| `estimatedTokens` | number | Estimated token count (~4 chars/token) |
| `markdown` | string | Clean LLM-ready markdown |
| `extractedAt` | string | ISO timestamp |

### Pricing

This actor uses Apify's **pay-per-event** pricing — you only pay for what you extract:

- **Actor start**: $0.01 per run
- **Per page extracted**: $0.005 per URL successfully converted

**Example costs:**

- 100 blog posts → $0.51
- 1,000 documentation pages → $5.01
- 10,000 articles for fine-tuning → $50.01

Compare to Firecrawl at $19/month for 500 credits, or $99/month for 5,000 credits. Pay-per-event is dramatically cheaper for moderate use and dramatically simpler for one-off extractions.

Free Apify tier members get $5/month in platform credits, which covers ~1,000 pages of extraction per month.

### Tips and advanced options

- **Disable `preserveImages`** when building text-only training datasets to slim the output
- **Disable `preserveLinks`** for pure plain-text RAG ingestion
- **Use `maxLength`** to enforce a per-page token budget (useful for fixed-context RAG)
- **Combine with the Sitemap URL Extractor** to ingest an entire website in two steps
- **Schedule daily runs** to keep your RAG dataset fresh as content changes
- **Pipe into Pinecone / Weaviate / Qdrant** via Apify webhooks for fully automated RAG ingestion

### FAQ and support

**How accurate is the boilerplate stripping?** Very good for typical blogs, news sites, documentation, and Wikipedia. Less good for heavily templated sites that use unusual class names. If you see junk in the output, disable `stripBoilerplate` and post-process yourself, or open an issue with the URL.

**What's the token count based on?** A reliable ~4 chars/token rule of thumb that matches GPT-4, Claude, and Llama tokenizers within ±10%.

**Does it follow redirects?** Yes. The `url` field shows the resolved URL.

**Does it work on JavaScript-rendered sites?** This is an HTTP-based extractor (no browser), so it works on server-rendered HTML. For SPAs and JavaScript-heavy sites, use a browser-based actor.

**Found a bug?** Open an issue on the Issues tab.

# Actor input Schema

## `startUrls` (type: `array`):

List of URLs to convert into LLM-ready markdown. Each URL becomes one dataset row.

## `stripBoilerplate` (type: `boolean`):

Remove navigation, advertising, sidebars, footer and other non-content elements. Highly recommended for RAG.

## `preserveLinks` (type: `boolean`):

Keep markdown links in the output. Disable for cleaner plain text.

## `preserveImages` (type: `boolean`):

Keep markdown image references (![alt](url)). Disable to skip images entirely.

## `includeMetadata` (type: `boolean`):

Attach page metadata as a YAML frontmatter block at the start of each markdown output.

## `maxLength` (type: `integer`):

Truncate the markdown output to this many characters. Use 0 for unlimited.

## `proxyConfiguration` (type: `object`):

Optional Apify Proxy. Use for sites that block direct requests.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol"
    }
  ],
  "stripBoilerplate": true,
  "preserveLinks": true,
  "preserveImages": true,
  "includeMetadata": true,
  "maxLength": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "startUrls": [
        {
            "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("wiry_kingdom/ai-web-to-markdown").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 = { "startUrls": [{ "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol" }] }

# Run the Actor and wait for it to finish
run = client.actor("wiry_kingdom/ai-web-to-markdown").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol"
    }
  ]
}' |
apify call wiry_kingdom/ai-web-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=wiry_kingdom/ai-web-to-markdown",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Web to Markdown - LLM-Ready Extractor",
        "description": "Convert any URL into clean LLM-ready markdown. Strips ads, nav, footer. Preserves headings, lists, tables, code blocks. Returns token count. Perfect for RAG, fine-tuning, AI agents. 10x cheaper than Firecrawl.",
        "version": "0.1",
        "x-build-id": "95BylnzkniWx4v14L"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/wiry_kingdom~ai-web-to-markdown/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-wiry_kingdom-ai-web-to-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/wiry_kingdom~ai-web-to-markdown/runs": {
            "post": {
                "operationId": "runs-sync-wiry_kingdom-ai-web-to-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/wiry_kingdom~ai-web-to-markdown/run-sync": {
            "post": {
                "operationId": "run-sync-wiry_kingdom-ai-web-to-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "URLs to extract",
                        "type": "array",
                        "description": "List of URLs to convert into LLM-ready markdown. Each URL becomes one dataset row.",
                        "default": [
                            {
                                "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol"
                            }
                        ],
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "stripBoilerplate": {
                        "title": "Strip ads, nav, footer, boilerplate",
                        "type": "boolean",
                        "description": "Remove navigation, advertising, sidebars, footer and other non-content elements. Highly recommended for RAG.",
                        "default": true
                    },
                    "preserveLinks": {
                        "title": "Preserve internal/external links",
                        "type": "boolean",
                        "description": "Keep markdown links in the output. Disable for cleaner plain text.",
                        "default": true
                    },
                    "preserveImages": {
                        "title": "Preserve image references",
                        "type": "boolean",
                        "description": "Keep markdown image references (![alt](url)). Disable to skip images entirely.",
                        "default": true
                    },
                    "includeMetadata": {
                        "title": "Include metadata (title, description, author)",
                        "type": "boolean",
                        "description": "Attach page metadata as a YAML frontmatter block at the start of each markdown output.",
                        "default": true
                    },
                    "maxLength": {
                        "title": "Max characters per output",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Truncate the markdown output to this many characters. Use 0 for unlimited.",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional Apify Proxy. Use for sites that block direct requests.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
