# AI Dataset Enricher – Bulk LLM Prompt on Every Row (`smoxy/dataset-ai-refinery`) Actor

Run an AI prompt or a ready preset (review sentiment, comment intent, translation, entities, classification, summary) on every row of any Apify dataset or pasted JSON. Valid JSON per row, cost estimate first. Failed and empty rows are free; repeated rows cost less.

- **URL**: https://apify.com/smoxy/dataset-ai-refinery.md
- **Developed by:** [Simone Flavio Paris](https://apify.com/smoxy) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.90 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Prompt on Every Row

**Run an AI prompt on every row of any Apify dataset** and get clean, schema-valid JSON back: review sentiment and aspects, comment intent, translation, entities, your own labels, summaries, or any custom prompt with your own JSON schema. Point it at the dataset of any scraper, or paste rows as JSON, run, and export the enriched rows as JSON, CSV or Excel.

Built for marketers, analysts, agencies and automation builders (n8n, Make, Zapier, Clay) who scrape reviews, comments, posts, products or job listings and want the data **already classified, translated or extracted**, without writing code or managing AI API keys.

### What does AI Dataset Enricher do?

For every row of your dataset you get:

- **Your original fields** (all of them, or only the ones you pick with `fieldsToKeep`)
- An **`ai` object** with the answer of the model, as JSON that follows the preset's schema or your own `outputSchema`
- An **`ai_meta` object**: the model that answered, input and output tokens, and whether the row came from cache
- A **status** for every row, so you always know why a row has no AI result

Ready presets:

| Preset | What you get |
|---|---|
| `review-sentiment-aspects` | Sentiment, score and the aspects mentioned (service, price, quality...) |
| `comment-intent` | The intent of a comment (question, complaint, purchase intent, praise...) |
| `translate` | Translation into one of 25 European languages (set `language`) |
| `entities` | Companies, products and places mentioned (never personal emails or phone numbers) |
| `classify` | One label per row from the labels you write in `prompt` |
| `summarize` | A short summary of the text |
| `custom` | Your own `prompt` and, optionally, your own `outputSchema` |

**You only pay for rows that got an AI result.** Rows with no text, rows that are too long, rows refused by the safety filter and rows where the model could not produce valid JSON are free. Rows already processed with the same text and settings are served from cache at a lower price.

### How to enrich a dataset with AI

1. Run any scraper from Apify Store (Google Maps reviews, Amazon reviews, TikTok, Instagram, Trustpilot, job boards...) and pick the dataset of that run in **Dataset** (one of your runs, or a dataset shared with you). Or paste your rows as JSON in **Rows**.
2. Pick a **preset**, or choose `custom` and write your **prompt** (and optionally an **output schema**).
3. The **text field** is detected automatically for the most popular scrapers (for example `text` in Google Maps and TikTok, `caption` in Instagram, `reviewDescription` in Amazon). For other datasets, set `textField`.
4. Optionally set `maxRows`, the `qualityTier` and the fields to keep.
5. Run. Each input row becomes one enriched row in the output dataset.

Run it with an empty input to see sample output rows (marked `is_example: true`): they are precomputed, take a second and cost nothing. Paste your own rows or a Dataset ID to get real results.

#### Run it automatically after your scraper

Open your scraper's **Integrations** tab, add this Actor as an Actor-to-Actor integration ("run after"), and set `datasetId` to the default dataset of the run that just finished (`{{resource.defaultDatasetId}}`). Every time the scraper finishes, its rows are enriched.

#### Input example

```json
{
  "datasetId": "YOUR_DATASET_ID",
  "preset": "review-sentiment-aspects",
  "textField": "",
  "fieldsToKeep": ["title", "stars", "text", "publishedAtDate"],
  "qualityTier": "cheap",
  "maxRows": 1000,
  "language": "en"
}
```

Custom prompt with your own schema:

```json
{
  "rows": [
    {"description": "Senior Go developer, fully remote within the EU, 70-85k EUR, Kubernetes required."}
  ],
  "preset": "custom",
  "prompt": "Extract the job details from the text.",
  "outputSchema": {
    "type": "object",
    "properties": {
      "role": {"type": "string"},
      "remote": {"type": "boolean"},
      "salary_max_eur": {"type": ["number", "null"]}
    },
    "required": ["role", "remote", "salary_max_eur"]
  },
  "textField": "description"
}
```

#### Output example

```json
{
  "title": "Trattoria da Mario",
  "stars": 3,
  "text": "Great pizza, but we waited 40 minutes and the waiter forgot our drinks.",
  "publishedAtDate": "2026-10-28T19:12:00Z",
  "ai": {
    "sentiment": "mixed",
    "score": -0.2,
    "aspects": [
      {"aspect": "food", "sentiment": "positive"},
      {"aspect": "waiting time", "sentiment": "negative"},
      {"aspect": "service", "sentiment": "negative"}
    ]
  },
  "ai_meta": {
    "model": "(id of the model that answered)",
    "tokens_in": 182,
    "tokens_out": 61,
    "cached": false
  },
  "ai_status": "ok"
}
```

The shape of `ai` depends on the preset or on your `outputSchema`; the example above is for `review-sentiment-aspects`.

### Status of each row

| `ai_status` | Meaning | Charged |
|---|---|---|
| `ok` | AI result ready | yes |
| `cached` | Same text and settings already processed: result served from cache | yes, at the lower cached price |
| `empty_text` | No text found in the row (empty or missing text field) | no |
| `too_long` | Text longer than about 16,000 input tokens | no |
| `invalid_output` | The model could not return JSON matching the schema, even after retries | no |
| `blocked` | Prompt or row refused by the safety filter | no |
| `error` | The AI service was temporarily unavailable; run again later | no |

Rows beyond `maxRows`, beyond the Free-plan limit or beyond your maximum charge per run are not processed and not charged.

### How much does it cost?

Pay per event: you pay only for rows that got an AI result.

| Event | Price (Free plan) | When it is charged |
|---|---|---|
| `row-processed` | $0.0015 | per row up to 2,000 input tokens with a short answer, processed with the fast low-cost model (`qualityTier: cheap`) |
| `row-processed-long` | $0.005 | on the cheap tier, instead of `row-processed`, for rows over 2,000 input tokens (up to about 16,000) or with a long answer such as a long translation: one charge per started block of 20,000 weighted tokens (input + 4 x answer + 350) |
| `row-quality` | $0.0025 | on the higher-quality model (`qualityTier: quality`), instead of `row-processed`: one charge per started block of 2,000 input tokens or 10,000 weighted tokens (input + 4 x answer + 350), whichever is more. A short row counts once, a 4,500-token row three times |
| `row-cached` | $0.0005 | per row served from cache (same text and settings already processed) |

Most reviews, comments and captions are far below 2,000 tokens (about 1,500 words).

**Example:** enriching 1,000 Google Maps reviews with the review sentiment preset costs **$1.50** on the Free plan. Paid Apify plans get up to **40% off**. You can see the estimated cost before a large run, and you can set a maximum charge per run in the Apify console: the Actor checks it before starting and processes only the items that fit in the remaining budget, so it never goes over it.

### Free plan limits

Users on the Apify Free plan can process up to **50 rows per run**. Paid plans have no per-run row limit other than `maxRows` and your maximum charge per run.

### Use it from AI agents (MCP server)

This Actor is also an **MCP server**, so AI agents and assistants (Claude, Cursor, VS Code, n8n and any MCP client) can classify, translate or extract data from rows by themselves. Connect your client to:

```
https://smoxy--dataset-ai-refinery.apify.actor/mcp
```

Transport: Streamable HTTP. Authentication: header `Authorization: Bearer <your Apify API token>`. For example, in Claude Code:

```
claude mcp add --transport http dataset-ai-refinery https://smoxy--dataset-ai-refinery.apify.actor/mcp --header "Authorization: Bearer YOUR_APIFY_TOKEN"
```

Tools:

| Tool | What it does |
|---|---|
| `refine_rows` | `rows` (texts or objects, up to 20 per call), `preset` or `prompt` with optional `outputSchema`, optional `textField`, `qualityTier`, `language`. Returns one AI result per row |
| `estimate_cost` | Same input as above. Returns the estimated tokens and price, without running anything |
| `get_job` | `job_id` (and optionally the row index to start from) → the results processed so far |

Same prices as normal runs: charged per row only when an AI result is delivered, never twice for the same row of a job; `estimate_cost` and `get_job` are free. To enrich a whole Apify dataset from an agent, use the Apify MCP server (`mcp.apify.com`, tool `smoxy/dataset-ai-refinery`): it starts a normal run with your token and `datasetId`.

**Limits for MCP calls**, the same for every caller: up to 20 items per call, up to 3 active jobs per user (more returns `too_many_jobs`, free). Repeating the same call with the same arguments within 10 minutes returns the cached result for free. A paid result is delivered only when it can be billed: otherwise the call returns `billing_unavailable` and nothing is charged.

### FAQ

#### Which datasets does it work with?

Any Apify dataset, from any Actor, or rows you paste as JSON. The text field is detected automatically for popular review and social media scrapers (Google Maps, Amazon, TikTok, Instagram, Trustpilot and others). If detection picks the wrong field, set `textField`.

#### Do I need my own AI API key?

No. The AI usage is included in the price per row.

#### Is the output always valid JSON?

Every answer is checked against the preset's schema or your `outputSchema` and retried if it does not match. A row that still fails is marked `invalid_output` and is **not charged**.

#### Can I use my own labels to classify rows?

Yes. Use the `classify` preset and list your labels in `prompt` (for example: "Labels: bug report, feature request, praise, pricing complaint"), or use `custom` with a schema that has an `enum` of your labels.

#### What is the difference between the cheap and the quality tier?

`cheap` uses a fast low-cost model and is right for sentiment, intent, labels and translation of short texts. `quality` uses a stronger model for harder prompts and longer reasoning, at a higher price per row. Both return the same JSON shape.

#### What am I not charged for?

Rows with no text, rows over the length limit, rows refused by the safety filter, rows without valid JSON after retries, and rows not processed because of a temporary error. Only rows with `ai_status` `ok` or `cached` are charged.

#### How long does it take?

Rows are processed in parallel batches: a few hundred short rows usually take a few minutes. Very large datasets take longer, and you can follow the progress in the run log.

#### Can I know the cost before running?

Yes. The Actor estimates tokens and cost before a large run, and over MCP the `estimate_cost` tool does it without running anything. The estimate is an approximation: the final cost depends on the real length of the texts.

#### Can I use it from an API, Make, Zapier or n8n?

Yes. Like any Apify Actor it runs via the Apify API, the Python and JavaScript clients, Make, Zapier and n8n, and can call a webhook when a run finishes.

### Notes and privacy

- **Your rows are sent to third-party AI model providers.** The text of each row (and your prompt) is processed by large language models reached through a model-routing service; it is not processed only on our own servers. Do not send data you are not allowed to share with such providers.
- Results are kept in a cache so that identical rows are not processed twice; the output is saved in your Apify dataset.
- You are responsible for having the right to process the data you send, in line with the terms of the site you scraped it from and with data protection law (for example GDPR). Avoid sending special categories of personal data.
- The `entities` preset does not extract personal emails or phone numbers.
- Prompts are checked by a safety filter, and each run has a row cap; abusive prompts are refused and not charged.
- AI answers can be wrong. Check a sample before using the results for decisions.

### Feedback

Found a problem or need a feature? Open an issue on the **Issues** tab: we answer within 24 hours. If the Actor saved you time, a **review** on this page helps other users find it.

# Actor input Schema

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

The dataset whose rows are processed (the output of another Actor). Leave empty to use the pasted rows below. If both are given, the dataset is used.

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

A list of objects, for example reviews or comments. Used when no dataset is given. Leave it empty, with no dataset, to run the free example: five static sample rows with the output of the sentiment preset, no model is called.

## `textField` (type: `string`):

Name of the field that holds the text to process. Leave empty to detect it automatically (text, reviewDescription, caption, comment, content and similar). A dotted name such as review.body reaches into objects.

## `fieldsToKeep` (type: `array`):

The fields of the original row that are copied to the output. Leave empty to keep all of them.

## `preset` (type: `string`):

What to do with every row. Choose custom, or clear this field, to use your own prompt.

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

Your own instruction for every row (custom preset), or an extra instruction that refines a preset. Up to 4000 characters.

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

JSON Schema of the answer for a custom prompt: an object with properties of type string, number, integer, boolean, array or object. All fields are required; use \["string","null"] for an optional value. Without a schema the answer is {"result": "..."}.

## `labels` (type: `array`):

For the classify preset: the labels to choose from (2 to 50). Every row gets exactly one.

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

For translate: the target language code (bg, ca, cs, da, de, el, en, es, et, fi, fr, ga, hr, hu, it, lt, lv, mt, nl, pl, pt, ro, sk, sl, sv). For the other presets: the language of the free-text values of the answer (default English).

## `qualityTier` (type: `string`):

cheap uses a fast, low-cost model. quality uses a stronger model for a higher price per row.

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

Upper bound of rows processed in this run (up to 5000). Accounts without a paid plan are limited to 50 rows per run.

## Actor input object example

```json
{
  "preset": "review-sentiment-aspects",
  "qualityTier": "cheap",
  "maxRows": 1000
}
```

# Actor output Schema

## `rows` (type: `string`):

No description

## `sentiment` (type: `string`):

No description

## `usage` (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 = {
    "preset": "review-sentiment-aspects"
};

// Run the Actor and wait for it to finish
const run = await client.actor("smoxy/dataset-ai-refinery").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 = { "preset": "review-sentiment-aspects" }

# Run the Actor and wait for it to finish
run = client.actor("smoxy/dataset-ai-refinery").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 '{
  "preset": "review-sentiment-aspects"
}' |
apify call smoxy/dataset-ai-refinery --silent --output-dataset

```

## MCP server setup

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

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/jtzAWjn14fPbB7D3O/builds/49Ndaq5IkrPYQgEe6/openapi.json
