# AI Dataset Enricher - Bulk LLM Classify, Tag & Summarise (`actor-forge/ai-dataset-enricher`) Actor

Run one AI prompt over every row of an Apify dataset, CSV/Excel/JSON file or pasted rows: classify, tag, score sentiment, summarise, translate or extract into typed fields you define. Cheap LLM via Apify's OpenRouter, billed at cost to your account. $0.70 per 1,000 rows plus tokens.

- **URL**: https://apify.com/actor-forge/ai-dataset-enricher.md
- **Developed by:** [ActorForge](https://apify.com/actor-forge) (community)
- **Categories:** AI, Automation, Developer tools
- **Security:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 row processeds

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## AI Dataset Enricher - Bulk LLM Classify, Tag & Summarise

Run one AI prompt over every row of an Apify dataset, CSV/Excel/JSON file or pasted rows: classify, tag, score sentiment, summarise, translate or extract into typed fields you define. Cheap LLM via Apify's OpenRouter, billed at cost to your account. $0.70 per 1,000 rows plus tokens.

**Run one AI prompt over every row of your data, in bulk.** Point it at an **Apify dataset** (reviews, jobs, leads, products, posts, tickets…), a **CSV, Excel or JSON file** or rows pasted as JSON, write what you want in plain English (*"Classify the review's sentiment and main topic"*, *"Write a 20-word summary"*, *"Translate to English"*, *"Extract seniority and remote/on-site"*, *"Score this lead 1-10 for B2B SaaS fit"*), list the **output fields** you want (or give a JSON Schema), and get every row back with **new, typed columns** (numbers, booleans and lists are converted). It sends only the fields you choose, retries a bad reply once, caps the AI spend per run, and can **estimate the cost first** without calling the model. Use it for **bulk sentiment analysis, text classification and tagging, lead scoring and qualification, data cleaning and normalisation, summarisation, translation, entity extraction and categorising products**, inside Apify pipelines or from Make, n8n, Zapier and AI agents. Default model **Google Gemini 2.5 Flash Lite**; any OpenRouter model works (GPT-5 nano, GPT-4o mini, Gemini 2.5 Flash, Claude, Llama, Mistral…). **$0.70 per 1,000 rows** plus the AI tokens at cost.

#### Two lines on your bill (please read)

1. **This actor's fee:** `row-processed`, **$0.0007 per row the model successfully enriched**. Rows that fail, empty rows and status rows are free.
2. **AI tokens, billed directly to your own Apify account** by Apify's official [OpenRouter actor](https://apify.com/apify/openrouter) at **OpenRouter's rates** (the run calls it with your run's own token; there is no extra API key and nothing is marked up by us). With the default model a short row (a review or a job title) costs about **$0.00002–0.0001** in tokens on a paid Apify plan. **On the Apify free plan, Apify charges AI tokens at 10× the OpenRouter rate**, plus a tiny per-call start fee.

Every row shows its own `_inputTokens`, `_outputTokens` and **`_llmCostUsd`** (the estimated token charge on your account, with the 10× free-plan rate applied when it applies), and the run summary totals them. **`maxLlmCostUsd` (default $0.10) is a hard cap on the token side**: each row's worst case is reserved before the call and the run stops cleanly before passing it. Every call also has a `max_tokens` limit. The run's maximum total charge caps this actor's own fee. If the AI service is unavailable or your account has no credit left, you get one free row explaining what happened, and the run still succeeds.

### What data does it return?

Every run outputs clean, schema-validated rows like these:

| text | sentiment | topic | \_status | \_inputTokens | \_outputTokens | \_llmCostUsd |
| --- | --- | --- | --- | --- | --- | --- |
| Great product, slow delivery | negative | delivery | ok | 98 | 14 | 0.00015 |
| Five stars, arrived next day | positive | delivery | ok | 97 | 13 | 0.00015 |

### How much does it cost?

Transparent pay-per-event pricing — you only pay for what you get, and the
actor **always respects your run budget**: set a maximum total charge and it
stops cleanly at the cap instead of overrunning.

| Event | Price | Charged | Worked example |
| --- | --- | --- | --- |
| `row-processed` | $0.0007 | per row successfully enriched by the model (failed, empty and skipped rows are free) | 10,000 reviews classified = $7.00 (+ AI tokens on your account, ≈ $0.50 on a paid plan with the default model) |
| `apify-actor-start` | $0.00005 | per run per GB of memory (platform start fee) | One run at 0.5 GB = $0.000025 |

### Input options

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `rows` | array | no | — | Rows pasted as a JSON array of objects. You can also (or instead) pick a dataset or give a file URL below. |
| `datasetId` | string | no | — | An Apify dataset to enrich, e.g. the output of a reviews, jobs or leads scraper. Picking it here gives this run read access to it. |
| `fileUrl` | string | no | — | A public CSV/TSV, JSON, JSON Lines or XLSX file (first row = column names, up to 50 MB). |
| `prompt` | string | yes | — | Plain-English instruction applied to every row, e.g. "Classify the review's sentiment and main topic", "Write a 20-word summary", "Translate the title to English", "Extract the company name and job seniority" or "Is this lead a B2B SaaS company? Answer true/false with a reason". |
| `outputSchema` | object | no | — | The fields to add, as {"field": "description or type"} (types number, integer, boolean and array are converted), or a full JSON Schema (also sent as a structured-output schema). Empty: the model returns any JSON object. |
| `inputFields` | array | no | — | Only send these fields of each row (dot paths allowed), to save tokens and keep private columns out of the prompt. Empty: the whole row. |
| `outputMode` | string | no | `"merge"` | Merge: the original row plus the new fields. Enriched only: just the new fields and *rowIndex. |
| `outputPrefix` | string | no | `""` | Optional prefix such as ai* so new fields never overwrite existing columns. |
| `model` | string | no | `"google/gemini-2.5-flash-lite"` | Any OpenRouter model id (openrouter.ai/models), e.g. google/gemini-2.5-flash-lite (default: cheap and fast), openai/gpt-5-nano, openai/gpt-4o-mini or google/gemini-2.5-flash (smarter). Tokens are billed to your Apify account at OpenRouter rates. |
| `maxLlmCostUsd` | number | no | `0.1` | Hard cap on the AI token charges this run may cause on your Apify account (estimated, including the 10× free-plan rate when it applies). The worst case of each row (its prompt plus maxOutputTokens) is reserved before the call; the run stops cleanly when the next row would pass the cap. Separate from this actor's per-row fee, which the run's maximum total charge limits. |
| `maxRows` | integer | no | `1000` | Process at most this many rows. |
| `maxInputTokensPerRow` | integer | no | `2000` | Rows larger than this (≈3 characters per token) are skipped with a free row; select fewer fields to fit. |
| `maxOutputTokens` | integer | no | `400` | max_tokens for each reply. A few labels need ~50; a summary ~150; long extractions more. |
| `estimateOnly` | boolean | no | `false` | Read the rows and report the expected AI token cost and this actor's fee without calling the model (one free row). |
| `allowPersonalData` | boolean | no | `false` | Off (default): the model is told not to output private individuals' personal contact details and personal-looking email addresses in its output are replaced. Switch on only if you have a lawful basis. |

### Limits & honest notes

- AI tokens are a second, separate charge on your own Apify account, made by apify/openrouter at OpenRouter's rates (10× on the Apify free plan). They are not part of this actor's pay-per-event price and are not limited by the run's maximum total charge: use maxLlmCostUsd (default $0.10) to cap them, and estimateOnly to preview the cost. Each row's \_llmCostUsd is an estimate from the usage OpenRouter reports; your Apify billing page is authoritative.
- AI models make mistakes. The model is told to use only the row's content and to return null when unsure, but check results that matter, especially classifications used for decisions about people.
- Row content is treated as data: the model is told to ignore instructions inside rows (prompt-injection defence), but no defence is perfect. Use inputFields to keep private columns out of the prompt.
- Personal data: by default the model is told not to output private individuals' contact details and personal-looking emails in its output are replaced. Only switch allowPersonalData on with a lawful basis.
- Datasets: with limited permissions the run can read only the dataset picked in the Dataset field (or passed by ID via the API). Files up to 50 MB; private and internal network addresses are refused at every redirect hop.
- If the AI service rejects the request (no credit, rate limit, unknown model id, outage), the run stops with one free status row "llm-unavailable" explaining why, and still finishes as SUCCEEDED.

### Related ActorForge actors

- [AI Web Extractor](https://apify.com/actor-forge/ai-web-extractor) — structured data from web pages with a prompt
- [Merge & Deduplicate Datasets](https://apify.com/actor-forge/dataset-merge-dedupe) — clean and merge datasets before enriching
- [Business Places Data](https://apify.com/actor-forge/business-places-data) — lead lists to score and qualify

### Changelog

- **2026-10-23** — Initial release: one prompt over every row of a dataset, CSV/JSON/XLSX file or pasted rows; typed output fields or JSON Schema; merge or enriched-only output; one retry per row; cost estimate; maxLlmCostUsd cap; apify/openrouter billed to the running account.

***

*Built and maintained by **ActorForge**. Reliability first: every actor in the
portfolio is monitored by an automated nightly self-test, and breakages are
typically fixed the same day.*

# Actor input Schema

## `rows` (type: `array`):

Rows pasted as a JSON array of objects. You can also (or instead) pick a dataset or give a file URL below.

## `datasetId` (type: `string`):

An Apify dataset to enrich, e.g. the output of a reviews, jobs or leads scraper. Picking it here gives this run read access to it.

## `fileUrl` (type: `string`):

A public CSV/TSV, JSON, JSON Lines or XLSX file (first row = column names, up to 50 MB).

## `prompt` (type: `string`):

Plain-English instruction applied to every row, e.g. "Classify the review's sentiment and main topic", "Write a 20-word summary", "Translate the title to English", "Extract the company name and job seniority" or "Is this lead a B2B SaaS company? Answer true/false with a reason".

## `outputSchema` (type: `object`):

The fields to add, as {"field": "description or type"} (types number, integer, boolean and array are converted), or a full JSON Schema (also sent as a structured-output schema). Empty: the model returns any JSON object.

## `inputFields` (type: `array`):

Only send these fields of each row (dot paths allowed), to save tokens and keep private columns out of the prompt. Empty: the whole row.

## `outputMode` (type: `string`):

Merge: the original row plus the new fields. Enriched only: just the new fields and \_rowIndex.

## `outputPrefix` (type: `string`):

Optional prefix such as ai\_ so new fields never overwrite existing columns.

## `model` (type: `string`):

Any OpenRouter model id (openrouter.ai/models), e.g. google/gemini-2.5-flash-lite (default: cheap and fast), openai/gpt-5-nano, openai/gpt-4o-mini or google/gemini-2.5-flash (smarter). Tokens are billed to your Apify account at OpenRouter rates.

## `maxLlmCostUsd` (type: `number`):

Hard cap on the AI token charges this run may cause on your Apify account (estimated, including the 10× free-plan rate when it applies). The worst case of each row (its prompt plus maxOutputTokens) is reserved before the call; the run stops cleanly when the next row would pass the cap. Separate from this actor's per-row fee, which the run's maximum total charge limits.

## `maxRows` (type: `integer`):

Process at most this many rows.

## `maxInputTokensPerRow` (type: `integer`):

Rows larger than this (≈3 characters per token) are skipped with a free row; select fewer fields to fit.

## `maxOutputTokens` (type: `integer`):

max_tokens for each reply. A few labels need ~50; a summary ~150; long extractions more.

## `estimateOnly` (type: `boolean`):

Read the rows and report the expected AI token cost and this actor's fee without calling the model (one free row).

## `allowPersonalData` (type: `boolean`):

Off (default): the model is told not to output private individuals' personal contact details and personal-looking email addresses in its output are replaced. Switch on only if you have a lawful basis.

## Actor input object example

```json
{
  "rows": [
    {
      "text": "Great product, slow delivery"
    }
  ],
  "prompt": "Classify sentiment (positive/neutral/negative) and the main topic",
  "outputSchema": {
    "sentiment": "string",
    "topic": "string"
  },
  "outputMode": "merge",
  "outputPrefix": "",
  "model": "google/gemini-2.5-flash-lite",
  "maxLlmCostUsd": 0.005,
  "maxRows": 1000,
  "maxInputTokensPerRow": 2000,
  "maxOutputTokens": 150,
  "estimateOnly": false,
  "allowPersonalData": false
}
```

# Actor output Schema

## `results` (type: `string`):

Each row with the AI-generated fields, status, model, tokens and AI token cost.

## `summary` (type: `string`):

Rows enriched, failed and skipped, LLM calls, tokens, AI token cost, why the run stopped and billing.

# 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 = {
    "rows": [
        {
            "text": "Great product, slow delivery"
        }
    ],
    "prompt": "Classify sentiment (positive/neutral/negative) and the main topic",
    "outputSchema": {
        "sentiment": "string",
        "topic": "string"
    },
    "maxLlmCostUsd": 0.005,
    "maxOutputTokens": 150
};

// Run the Actor and wait for it to finish
const run = await client.actor("actor-forge/ai-dataset-enricher").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 = {
    "rows": [{ "text": "Great product, slow delivery" }],
    "prompt": "Classify sentiment (positive/neutral/negative) and the main topic",
    "outputSchema": {
        "sentiment": "string",
        "topic": "string",
    },
    "maxLlmCostUsd": 0.005,
    "maxOutputTokens": 150,
}

# Run the Actor and wait for it to finish
run = client.actor("actor-forge/ai-dataset-enricher").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 '{
  "rows": [
    {
      "text": "Great product, slow delivery"
    }
  ],
  "prompt": "Classify sentiment (positive/neutral/negative) and the main topic",
  "outputSchema": {
    "sentiment": "string",
    "topic": "string"
  },
  "maxLlmCostUsd": 0.005,
  "maxOutputTokens": 150
}' |
apify call actor-forge/ai-dataset-enricher --silent --output-dataset

```

## MCP server setup

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

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/9rCnTQWfPuFT0QSyV/builds/W4d4ZtRGXUZ0NEHA9/openapi.json
