# AI Web Data Extractor (Your Own LLM Key, JSON Schema) (`gigsmith/ai-web-data-extractor`) Actor

Turn any web page into clean JSON. Give URLs plus a field list or JSON Schema; your own OpenAI, Groq, OpenRouter, Anthropic or OpenAI-compatible key does the reading. Schema-validated output, robots.txt respected. $0.01 per page.

- **URL**: https://apify.com/gigsmith/ai-web-data-extractor.md
- **Developed by:** [Gigsmith](https://apify.com/gigsmith) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 page extracteds

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 Web Data Extractor: turn any web page into JSON with your own LLM key

**AI Web Data Extractor** reads the web pages you give it and returns exactly the fields you ask for as clean, validated JSON. List the fields in plain English (or paste a JSON Schema), add your own **OpenAI, Groq, OpenRouter, Anthropic or any OpenAI-compatible** API key, and get one dataset row per page. It **costs $0.01 per page**, a third of the price of comparable AI scrapers, with no start fee.

No CSS selectors and no code to maintain when a site changes its layout. You describe the data, the model reads the page, and the Actor checks every answer against your schema before you pay for it.

### What can this AI web scraper do?

- 🧠 **Structured extraction from any page**: product details, prices, job posts, events, company facts, contact details, article metadata, real-estate listings and more
- 🧾 **Your schema, enforced**: write fields like `price (number): price in USD`, or paste a full JSON Schema. Every answer is validated, retried once if it doesn't fit, and **never charged if it still fails**
- 📋 **List mode**: one page in, many records out (all products on a category page, all jobs on a careers page) as `data.items`
- 🔑 **Bring your own model**: OpenAI, Groq, OpenRouter, Anthropic Claude, or any OpenAI-compatible API (Together, DeepSeek, Mistral, Fireworks, local gateways). Your provider bills your key directly for tokens, so you control model choice and cost
- 🧹 **Token-efficient page cleaning**: scripts, styles and boilerplate are removed; headings, lists, tables, links, image alt text and JSON-LD structured data are kept
- 🤝 **Polite by default**: respects each site's robots.txt, waits between requests to the same site, and honours `Crawl-delay`
- 💸 **Fair billing**: pages that fail to load, are blocked by robots.txt, have no text, or produce an invalid answer are reported in the dataset and **not charged**

### Who uses AI web data extraction?

- **AI and data teams** feeding clean JSON into RAG pipelines, agents and databases
- **E-commerce and pricing analysts** pulling product names, prices and stock from competitor pages
- **Recruiters and sales ops** turning careers pages, directories and company pages into rows
- **No-code builders** using Make, Zapier or n8n who need structured data without writing a scraper

### How to extract data from a website with AI

1. Click **Try for free**.
2. Paste page links into **Start URLs**.
3. Under **Fields to extract**, write one field per line, for example `title`, `price (number): price in USD`, `inStock (boolean)`. Or paste a **JSON Schema** for full control.
4. Pick your **LLM provider**, paste your **LLM API key**, and optionally choose a **Model**.
5. Click **Start**. Each page becomes one row in the **Output** tab, downloadable as JSON, CSV or Excel, or readable through the Apify API.

#### Input example

```json
{
  "startUrls": [{ "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html" }],
  "fields": [
    "title",
    "price (number): price as a number without the currency sign",
    "currency: ISO code such as GBP or USD",
    "inStock (boolean)",
    "availableCount (integer): number of copies available"
  ],
  "llmProvider": "groq",
  "llmApiKey": "<your key>",
  "model": "llama-3.3-70b-versatile"
}
```

| Field | What it does |
|---|---|
| `startUrls` | Pages to extract from. Each URL is fetched once; there is no crawling |
| `fields` | One field per line: `name`, `name: description` or `name (type): description`. Types: `string`, `number`, `integer`, `boolean`, `url`, `string[]`, `number[]`, `url[]` |
| `jsonSchema` | Optional JSON Schema (`"type": "object"`). Replaces `fields` |
| `extractList` | Return every matching record on the page as `data.items` |
| `instructions` | Plain-English hints for the model |
| `llmProvider` | `openai`, `groq`, `openrouter`, `anthropic` or `custom` |
| `llmApiKey` | Your own key (stored encrypted, never logged or saved to the dataset) |
| `model` | Optional. Defaults: `gpt-4o-mini`, `llama-3.3-70b-versatile`, `openai/gpt-4o-mini`, `claude-haiku-4-5` |
| `llmBaseUrl` | For `custom`: an OpenAI-compatible base URL such as `https://api.together.xyz/v1` |
| `maxContentChars` | Cap on page characters sent to the model (default 40,000) to control token cost |
| `includeLinks` | Keep link and image URLs in the text the model sees (default on) |
| `includePageText` | Add the cleaned text the model saw, for auditing answers |
| `maxPages`, `maxConcurrency`, `requestDelaySecs` | Run size, parallelism and per-site delay |

#### Output example

Illustrative output for the input above (the values are the ones shown on that page):

```json
{
  "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
  "finalUrl": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
  "httpStatus": 200,
  "status": "ok",
  "error": null,
  "data": {
    "title": "A Light in the Attic",
    "price": 51.77,
    "currency": "GBP",
    "inStock": true,
    "availableCount": 22
  },
  "pageTitle": "A Light in the Attic | Books to Scrape - Sandbox",
  "contentChars": 5210,
  "contentTruncated": false,
  "llmProvider": "groq",
  "model": "llama-3.3-70b-versatile",
  "processingSeconds": 2.1
}
```

Rows that fail have `"status": "error"` and a plain-English `error`, for example `"Blocked by the site's robots.txt, so the page was not fetched"`. When an answer doesn't match the schema, the row also carries `schemaErrors` and `rawOutput` so you can adjust your fields. The run's `OUTPUT` record holds a summary with counts, charged events and your total LLM token usage.

### How much does AI web extraction cost?

This Actor uses **pay-per-event** pricing. You pay only for pages turned into valid JSON.

| Event | Price | When it's charged |
|---|---|---|
| `page-extracted` | **$0.01** | Once per page whose answer passed your schema |

- No monthly rental and no start fee beyond Apify's standard run-start event of $0.00005 per run. Apify platform usage is included in the price.
- 1,000 pages cost **$10**. Your LLM provider bills your own key for tokens separately; with a small model such as `gpt-4o-mini` or Groq's Llama models that is typically a fraction of a cent per page.
- Failed, blocked and invalid pages are **not charged**.
- Set **Max charge per run** in the run options to cap your spend. When it's reached, the remaining pages are marked `skipped`, free of charge.

### Tips for accurate extraction

- Describe each field: `price (number): the sale price, not the crossed-out price` beats `price`.
- Use **List mode** for category, search and directory pages.
- If a field is often empty, add an **Extra instruction** saying where it appears on the page.
- Pages that build their content with JavaScript may show little text in their HTML. Check `includePageText` on one page to see what the model receives.
- Lower `maxContentChars` for long pages if the data you need is near the top, to save tokens.

### FAQ

**Which LLM should I use?** Start with the default for your provider. Small, fast models handle most product and listing pages. Use a larger model for messy pages or long lists.

**Is my API key safe?** The key field is marked secret, so Apify stores it encrypted. The Actor sends it only to the provider you chose and removes it from any error message before logging.

**Does it render JavaScript?** Not in this version. It reads the HTML the server returns, including embedded JSON-LD. Most product, article and listing pages work; single-page apps that load everything client-side may not.

**Does it crawl a whole site?** No. It extracts from the URLs you give it. Combine it with a sitemap or link-list Actor to build the URL list.

**Is it legal to scrape these pages?** You choose the pages, so check that their terms allow automated access. The Actor follows robots.txt and rate-limits every site.

**Something went wrong?** Open an issue on the **Issues** tab with the run link and I'll fix it.

### Keywords

AI web scraper, AI data extraction, LLM scraper, web page to JSON, structured data extraction, GPT web scraper, Claude web scraper, Groq scraper, OpenAI scraper, JSON schema extraction, no-code scraper, product data extraction, AI crawler, extract data from website

***

Made by **Gigsmith**.

# Actor input Schema

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

Public web pages to extract from. Each URL is fetched once (no crawling). Pages blocked by the site's robots.txt are skipped and not charged.

## `fields` (type: `array`):

One field per line: `name`, `name: description` or `name (type): description`. Types: string (default), number, integer, boolean, url, string\[], number\[], url\[]. Ignored when a JSON Schema is set.

## `jsonSchema` (type: `object`):

Full control over the output: a JSON Schema with "type": "object" and properties. When set, it replaces "Fields to extract". Every answer is validated against it, and answers that fail are not charged.

## `extractList` (type: `boolean`):

Turn on for listing pages (products, jobs, people, events). The output becomes `data.items`, an array where each item matches your fields or schema.

## `instructions` (type: `string`):

Plain-English hints, e.g. "Prices are in EUR" or "Only include speakers, not organizers".

## `llmProvider` (type: `string`):

Which service your key belongs to. Your provider bills your key directly for tokens; this Actor charges only its per-page fee.

## `llmApiKey` (type: `string`):

Your own API key for the provider above. Stored encrypted by Apify and never written to the dataset or log.

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

Leave empty for a fast, low-cost default: gpt-4o-mini (OpenAI), llama-3.3-70b-versatile (Groq), openai/gpt-4o-mini (OpenRouter), claude-haiku-4-5 (Anthropic). Required for a custom provider.

## `llmBaseUrl` (type: `string`):

Only for "Other OpenAI-compatible API", e.g. https://api.together.xyz/v1 or https://api.deepseek.com/v1. The Actor calls {base}/chat/completions.

## `maxPages` (type: `integer`):

Stop after this many URLs.

## `maxContentChars` (type: `integer`):

Longer pages are cut to this length to control your token cost (about 4 characters per token).

## `includeLinks` (type: `boolean`):

Lets the model return URLs (product links, image URLs). Turn off to save tokens if you don't need URLs.

## `includePageText` (type: `boolean`):

Adds `pageText`, the exact text the model saw. Useful for checking answers.

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

Raise it for long lists.

## `requestDelaySecs` (type: `integer`):

Minimum gap between two requests to one website. A robots.txt Crawl-delay is honoured when it is longer.

## `maxConcurrency` (type: `integer`):

Pages processed at once across different sites. Requests to the same site still wait for the delay above.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"
    }
  ],
  "fields": [
    "title",
    "price (number): price as a number without the currency sign",
    "currency: ISO code such as GBP or USD",
    "inStock (boolean)",
    "availableCount (integer): number of copies available",
    "category"
  ],
  "extractList": false,
  "llmProvider": "openai",
  "maxPages": 100,
  "maxContentChars": 40000,
  "includeLinks": true,
  "includePageText": false,
  "maxOutputTokens": 4096,
  "requestDelaySecs": 1,
  "maxConcurrency": 3
}
```

# Actor output Schema

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

Default dataset items, shown in the "Extracted data" view.

## `detailsView` (type: `string`):

Default dataset items, shown in the "Details" view.

## `runSummary` (type: `string`):

JSON summary of the run: URLs processed, ok/error/skipped counts, HTTP requests and charged events.

# 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://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"
        }
    ],
    "fields": [
        "title",
        "price (number): price as a number without the currency sign",
        "currency: ISO code such as GBP or USD",
        "inStock (boolean)",
        "availableCount (integer): number of copies available",
        "category"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gigsmith/ai-web-data-extractor").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://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html" }],
    "fields": [
        "title",
        "price (number): price as a number without the currency sign",
        "currency: ISO code such as GBP or USD",
        "inStock (boolean)",
        "availableCount (integer): number of copies available",
        "category",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("gigsmith/ai-web-data-extractor").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 '{
  "startUrls": [
    {
      "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"
    }
  ],
  "fields": [
    "title",
    "price (number): price as a number without the currency sign",
    "currency: ISO code such as GBP or USD",
    "inStock (boolean)",
    "availableCount (integer): number of copies available",
    "category"
  ]
}' |
apify call gigsmith/ai-web-data-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gigsmith/ai-web-data-extractor"
        }
    }
}
```

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/sKtQjnAPbxkTzignf/builds/99ATgaV5kwFkIrXsb/openapi.json
