# Apify Actor Cost Estimator (`agentictools/actor-cost-estimator`) Actor

Estimate what an Apify Actor will cost before you run it, across its pricing model and your workload.

- **URL**: https://apify.com/agentictools/actor-cost-estimator.md
- **Developed by:** [Ken Agland](https://apify.com/agentictools) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 estimate returneds

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

## Apify Actor Cost Estimator

Estimate what an Apify Actor will cost before you run it, across its pricing model and your workload.

### What it does

- Reads the live pricing for each Actor from the Apify API.
- Computes an estimate from the pricing model and your workload (results per run, number of runs, events per run).
- Handles FREE, PRICE\_PER\_DATASET\_ITEM, PAY\_PER\_EVENT, and FLAT\_PRICE\_PER\_MONTH.
- States its assumptions on every item, and flags any Actor it cannot estimate.
- Returns an aggregate summary: total estimated cost, plus the cheapest and most expensive Actor.

### Example input

```json
{
  "actors": [
    "apify/instagram-scraper",
    "compass/crawler-google-places"
  ],
  "resultsCount": 1000,
  "runs": 1
}
```

For a PAY\_PER\_EVENT Actor you can set exact event counts per run:

```json
{
  "actors": [
    "compass/crawler-google-places"
  ],
  "resultsCount": 500,
  "runs": 4,
  "eventsPerRun": {
    "place-scraped": 500,
    "filter-applied": 500
  }
}
```

### Input

| Field | Type | Description |
|---|---|---|
| `actors` | array | Actors to estimate, each as `username/name` or an Actor id. Required. |
| `resultsCount` | integer | Expected dataset items per run. Used for per-result and per-event pricing. Default 1000. |
| `runs` | integer | How many runs to estimate. The total multiplies the per-run cost by this. Default 1. |
| `eventsPerRun` | object | Optional. For PAY\_PER\_EVENT Actors, a map of event name to count per run. |

### Output

Each dataset item is one Actor:

```json
{
  "fullName": "apify/instagram-scraper",
  "title": "Instagram Scraper",
  "pricingModel": "PAY_PER_EVENT",
  "unitLabel": "per Result",
  "unitPriceUsd": 0.0027,
  "estimatedCostPerRunUsd": 2.7,
  "estimatedTotalUsd": 2.7,
  "assumptions": "Charged events per run: result x1000 (results per run). Add-on events not listed are assumed unused. Prices use the FREE plan tier across 1 run(s). Provide eventsPerRun to override counts. Paid plans get lower tiers. Platform compute is billed separately.",
  "pricingDetail": {
    "pricingModel": "PAY_PER_EVENT",
    "minimalMaxTotalChargeUsd": 0.0027,
    "events": {
      "result": {
        "unitPriceUsd": 0.0027,
        "isPrimary": true,
        "isOneTime": false
      }
    }
  }
}
```

When a model cannot be estimated from the inputs, `estimatedTotalUsd` is `null` and `assumptions` explains why.

#### Run summary (OUTPUT)

The run's default key-value store record `OUTPUT` holds an aggregate:

```json
{
  "workload": {
    "resultsCount": 1000,
    "runs": 1,
    "planTier": "FREE"
  },
  "actorsRequested": 2,
  "actorsEstimated": 2,
  "actorsNotEstimated": 0,
  "totalEstimatedUsd": 6.7,
  "cheapest": {
    "fullName": "apify/instagram-scraper",
    "estimatedTotalUsd": 2.7
  },
  "mostExpensive": {
    "fullName": "compass/crawler-google-places",
    "estimatedTotalUsd": 4.0
  },
  "pricingBreakdown": {
    "PAY_PER_EVENT": 2
  }
}
```

### How it works

For each Actor the Actor calls `https://api.apify.com/v2/acts/<username~name>` and reads `currentPricingInfo`, falling back to the most recent entry in `pricingInfos`. It then applies the pricing model:

- FREE: no charge for the Actor.
- PRICE\_PER\_DATASET\_ITEM: price per result times results per run, across runs.
- PAY\_PER\_EVENT: per-event prices; the primary per-result event defaults to your results per run, one-time events count once, add-ons are assumed unused unless set in `eventsPerRun`.
- FLAT\_PRICE\_PER\_MONTH: a fixed monthly rental, independent of runs.

When an Actor uses tiered pricing, the estimate uses the FREE plan tier, which is the highest per-unit price and therefore a conservative upper bound. Paid plans get lower tiers. A per-run minimum charge is applied where the Actor defines one. Apify platform compute (memory and CPU time) is billed separately and is not included.

This Actor uses the run's `APIFY_TOKEN` automatically for the pricing lookups.

MIT licensed.

# Actor input Schema

## `actors` (type: `array`):

One or more Actors to estimate, each as "username/name" (for example "apify/instagram-scraper") or an Actor id. Pricing is read live from the Apify API.

## `resultsCount` (type: `integer`):

Expected number of dataset items produced per run. Used for per-result and per-event pricing.

## `runs` (type: `integer`):

How many times you plan to run each Actor. The total estimate multiplies the per-run cost by this number.

## `eventsPerRun` (type: `object`):

Optional. For PAY\_PER\_EVENT Actors, a map of event name to count charged per run (for example { "place-scraped": 500, "filter-applied": 500 }). Event names not listed fall back to sensible defaults: the primary per-result event uses the results per run, one-time events count once.

## Actor input object example

```json
{
  "actors": [
    "apify/instagram-scraper"
  ],
  "resultsCount": 1000,
  "runs": 1,
  "eventsPerRun": {}
}
```

# 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 = {
    "actors": [
        "apify/instagram-scraper",
        "compass/crawler-google-places"
    ],
    "eventsPerRun": {}
};

// Run the Actor and wait for it to finish
const run = await client.actor("agentictools/actor-cost-estimator").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 = {
    "actors": [
        "apify/instagram-scraper",
        "compass/crawler-google-places",
    ],
    "eventsPerRun": {},
}

# Run the Actor and wait for it to finish
run = client.actor("agentictools/actor-cost-estimator").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 '{
  "actors": [
    "apify/instagram-scraper",
    "compass/crawler-google-places"
  ],
  "eventsPerRun": {}
}' |
apify call agentictools/actor-cost-estimator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,agentictools/actor-cost-estimator"
        }
    }
}

```

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/TBnTDnA2klLeHH0ws/builds/YMx1JEZG7j9bRKybk/openapi.json
