Cost Watchdog
Monitor compute costs and spending trends across your Apify actor fleet. Detect cost spikes, identify expensive actors, and track spending against budgets.
Maintenance Pulse
90/100Cost Estimate
How many results do you need?
Pricing
Pay Per Event model. You only pay for what you use.
| Event | Description | Price |
|---|---|---|
| cost-analysis | Charged per cost analysis run. | $0.25 |
Example: 100 events = $25.00 · 1,000 events = $250.00
Documentation
Cost Watchdog monitors your Apify account spending, flags runaway actors before they become surprise bills, and sends webhook alerts the moment your budget is at risk. It is built for Apify developers, agencies, and teams who run actors at volume and need continuous visibility into where their credits go.
A single misconfigured actor can burn through a month's budget overnight. Cost Watchdog analyzes your recent run history, ranks actors by cost, detects anomalous runs using a per-actor average baseline, and projects your daily and monthly spend — all in one structured report. Schedule it hourly and connect a Slack webhook to replace manual console-checking entirely.
What data can you extract?
| Data Point | Source | Example |
|---|---|---|
| 💰 Total spend | Apify run API | $4.52 for last 24 hours |
| 📈 Projected daily spend | Linear extrapolation from window | $4.52 |
| 📅 Projected monthly spend | Annualized from current rate | $135.60 |
| 🏆 Top spenders | Per-actor cost aggregation | ryanclinton/website-contact-scraper — $2.10 across 45 runs |
| 💲 Avg cost per run | Actor-level cost profile | $0.047 per run |
| ⚠️ Anomalous runs | Per-actor average deviation detection | Run cost $1.20 vs actor avg $0.15 — 8.0x multiplier |
| 📊 Cost trend | First-half vs second-half window comparison | increasing / stable / decreasing |
| ✅ Run success rate | Status field from run API | 54 succeeded, 3 failed out of 57 total |
| 🔔 Budget status | Threshold comparison | DAILY_EXCEEDED / MONTHLY_PROJECTED_EXCEEDED / OK |
| 📤 Alert sent flag | Webhook delivery confirmation | true / false |
| 🕐 Analysis window | Configurable hours back | last 24 hours |
| 🔑 Actor IDs resolved | Actor detail API with caching | ryanclinton/google-maps-email-extractor |
Why use Cost Watchdog for Apify spending monitoring?
Without a monitoring tool, you find out about budget overruns when the invoice arrives. Checking the Apify Console manually takes 10 minutes per day, misses subtle cost creep, and gives you no alerting when something goes wrong at 2am.
Cost Watchdog automates the entire process. One scheduled run per hour gives you continuous oversight across your entire actor fleet — which actors are your biggest spenders, which individual runs behaved abnormally, and whether your total spend is trending up. The webhook integration means you get a Slack message within 60 minutes of any budget breach, not 30 days later.
- Scheduling — run every hour, every 6 hours, or daily to maintain continuous budget visibility
- API access — trigger checks from Python, JavaScript, or any HTTP client and integrate reports into your own dashboards
- Webhook alerts — POST to Slack incoming webhooks, Discord, or any custom endpoint the moment a threshold is crossed
- Monitoring — pair with Apify's native email alerts for a layered alerting strategy
- Integrations — connect results to Google Sheets, HubSpot, or Zapier for team-wide spending visibility
Features
- Per-actor cost aggregation — groups all runs by actor ID within the analysis window and sums
usageTotalUsdto produce per-actor spending profiles with run counts and average cost per run - Anomaly detection with configurable threshold — for every actor with 2 or more runs, compares each run's cost against the actor's average; flags any run exceeding the multiplier threshold (default 3x) with a plain-language reason such as "Run lasted 45 minutes vs usual 5 minutes"
- Duration-based anomaly reasons — when
startedAtandfinishedAtare both available, the anomaly reason compares actual run duration to the actor's average duration rather than just citing raw cost figures - Daily and monthly budget projections — calculates cost-per-hour from the analysis window and extrapolates to 24-hour and 30-day projected totals; compares both to your configured budgets
- Four-state budget status — returns
OK,DAILY_EXCEEDED,MONTHLY_PROJECTED_EXCEEDED, orBOTH_EXCEEDEDso downstream automation can branch on a single field - Cost trend analysis — splits the analysis window at its midpoint and computes spending in each half; reports
increasingif the second half costs 30% or more than the first,decreasingif it's 30% less, otherwisestable - Run success tracking — counts runs by status (
SUCCEEDED,FAILED,ABORTED,TIMED-OUT) to surface failure rate alongside spend - Top 10 spender ranking — returns up to 10 actors sorted by total spend, each with actor name, ID, run count, total cost, and average cost per run
- Up to 20 anomaly records — surfaces the 20 worst anomalies sorted by cost multiplier descending
- Webhook delivery with Slack/Discord compatibility — alert payload includes a
textfield matching the Slack incoming webhook format, plus the full structured report for custom integrations - Paginated run fetching with page guard — fetches up to 1,000 runs per page, paginates until the cutoff date is reached, and caps at 50 pages (50,000 runs) to prevent runaway API usage
- Exponential backoff on rate limits — detects HTTP 429 responses and retries with 2-second base delay using
Math.pow(2, attempt) * 2000msbackoff - Actor name resolution with in-memory cache — resolves actor IDs to
username/nameslugs via the Apify actor detail API; caches results to avoid redundant requests; top 20 spenders resolved in parallel viaPromise.all - Fallback cost calculation — reads
usageTotalUsdfirst; falls back to summing all fields inusageUsdbreakdown (compute units, dataset reads/writes, key-value store reads/writes, request queue reads/writes) when the top-level field is absent
Use cases for Apify spending monitoring
Continuous budget monitoring for production actor fleets
DevOps engineers and platform teams running dozens of scheduled actors need automated guardrails, not manual console checks. Schedule Cost Watchdog every hour with a $10 daily budget and a Slack webhook. When a scraper hangs or a loop escapes its bounds, you receive an alert within 60 minutes instead of discovering the damage at month end.
Post-mortem cost analysis
After a surprise charge on your Apify invoice, run Cost Watchdog with hoursBack set to 168 (one full week) to reconstruct exactly what happened. The top spenders list and anomaly records identify which actor and which specific run IDs caused the spike, making root-cause analysis straightforward.
Agency billing and client cost allocation
Agencies running separate actor workloads for multiple clients can schedule a Cost Watchdog check at the end of each day with a 24-hour window. The per-actor breakdown maps directly to client work, making it easy to reconcile Apify costs against client invoices or retainer budgets.
Actor cost optimization
Use the average cost per run field to benchmark your actors against each other. An actor averaging $0.50 per run when comparable scrapers cost $0.05 is a signal to investigate memory allocation, crawl depth settings, or unnecessary proxy usage. Cost Watchdog surfaces these outliers without requiring manual run-by-run auditing.
Team spending governance
Engineering leads managing a shared Apify team account can set up Cost Watchdog as a daily scheduled task. The structured JSON output can be pushed to a shared Google Sheet via Zapier, giving the entire team visibility into credit consumption without requiring each person to log into the console.
Runaway actor detection
Actors with infinite retry loops, misconfigured request queues, or unexpectedly large datasets can cost 10-100x their normal amount on a single run. The anomaly detector compares each run against that actor's own historical average — a single bad run costing 8x the actor's normal amount triggers an immediate webhook alert.
How to monitor Apify spending with Cost Watchdog
- Get your API token — Log into the Apify Console, go to Settings > Integrations, and copy your API token. This is the only required input.
- Set your budget thresholds — Enter a daily budget (e.g., $10) and a monthly budget (e.g., $200). Leave either blank to skip that check.
- Add a webhook URL (optional) — Paste a Slack incoming webhook URL, a Discord webhook URL, or any endpoint that accepts POST JSON. Cost Watchdog will hit it automatically when a threshold is crossed.
- Run the actor — Click Start. The analysis completes in under 30 seconds for most accounts. Download the single-record spending report from the Dataset tab as JSON or CSV.
Input parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
apiToken | String | Yes | — | Your Apify API token. Found at Console > Settings > Integrations. Stored as a secret field. |
dailyBudget | Number | No | 5.00 (prefill) | Alert if projected daily spending exceeds this amount in USD. Leave empty to skip. |
monthlyBudget | Number | No | 50.00 (prefill) | Alert if projected monthly spending exceeds this amount in USD. Leave empty to skip. |
anomalyThreshold | Number | No | 3 | Multiplier above actor average that flags a run as an anomaly. Minimum 1.5. |
webhookUrl | String | No | — | URL to POST alert data to. Compatible with Slack, Discord, and any HTTP endpoint. |
hoursBack | Integer | No | 24 | Analysis window size in hours. Range: 1-720. Use 168 for a full week. |
Input examples
Daily budget check with Slack alerts:
{
"apiToken": "apify_api_xxxxxxxxxxxxxxxxxxxx",
"dailyBudget": 10.00,
"monthlyBudget": 200.00,
"anomalyThreshold": 3,
"webhookUrl": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXX",
"hoursBack": 24
}
Weekly retrospective with tight anomaly detection:
{
"apiToken": "apify_api_xxxxxxxxxxxxxxxxxxxx",
"dailyBudget": 15.00,
"monthlyBudget": 300.00,
"anomalyThreshold": 2,
"hoursBack": 168
}
Minimal quick check — no budgets, just a spending snapshot:
{
"apiToken": "apify_api_xxxxxxxxxxxxxxxxxxxx",
"hoursBack": 24
}
Input tips
- Start with the defaults —
anomalyThreshold: 3andhoursBack: 24cover the most common monitoring use case without generating noise. - Lower the anomaly threshold cautiously — setting it to 1.5 will flag many normal runs with natural cost variance; 2.5 is a good middle ground for sensitive monitoring.
- Use 168 hours for monthly cost investigations — a one-week window captures full scheduling cycles and gives more accurate trend analysis.
- Set both daily and monthly budgets together — daily catches intraday spikes; monthly catches slow cost creep that looks fine day-to-day.
- Schedule with a webhook instead of polling — one hourly run at $0.05 per check is $1.50/month and removes the need to manually review the console.
Output example
{
"type": "spending-report",
"period": "last 24 hours",
"totalSpend": 6.84,
"projectedDailySpend": 6.84,
"projectedMonthlySpend": 205.20,
"dailyBudget": 10.00,
"monthlyBudget": 200.00,
"budgetStatus": "MONTHLY_PROJECTED_EXCEEDED",
"topSpenders": [
{
"actor": "ryanclinton/website-contact-scraper",
"actorId": "BCq991ez5HObhS5n0",
"runs": 62,
"totalCost": 3.10,
"avgCostPerRun": 0.0500
},
{
"actor": "ryanclinton/google-maps-email-extractor",
"actorId": "Ge9Jt8xWq4nEiK3mP",
"runs": 18,
"totalCost": 2.70,
"avgCostPerRun": 0.1500
},
{
"actor": "ryanclinton/company-deep-research",
"actorId": "2cAY2V9yz1JE2H1S2",
"runs": 5,
"totalCost": 1.04,
"avgCostPerRun": 0.2080
}
],
"anomalies": [
{
"actor": "ryanclinton/company-deep-research",
"actorId": "2cAY2V9yz1JE2H1S2",
"runId": "run_xR7tK2mN9pQjL4wD",
"cost": 0.8750,
"avgCost": 0.1040,
"multiplier": 8.4,
"reason": "Run lasted 52 minutes vs usual 6 minutes"
},
{
"actor": "ryanclinton/website-contact-scraper",
"actorId": "BCq991ez5HObhS5n0",
"runId": "run_aB3cD7eF1gH5iJ9k",
"cost": 0.1820,
"avgCost": 0.0500,
"multiplier": 3.6,
"reason": "Run lasted 14 minutes vs usual 4 minutes"
}
],
"costTrend": "increasing",
"alertSent": true,
"totalRuns": 85,
"successfulRuns": 81,
"failedRuns": 4,
"checkedAt": "2026-03-20T09:15:00.000Z"
}
Output fields
| Field | Type | Description |
|---|---|---|
type | String | Always spending-report — useful for routing in downstream pipelines |
period | String | Human-readable description of the analysis window (e.g., last 24 hours) |
totalSpend | Number | Total USD spent across all runs in the window, rounded to 2 decimal places |
projectedDailySpend | Number | Cost-per-hour from the window extrapolated to 24 hours |
projectedMonthlySpend | Number | Cost-per-hour from the window extrapolated to 30 days |
dailyBudget | Number|null | Your configured daily budget, or null if not set |
monthlyBudget | Number|null | Your configured monthly budget, or null if not set |
budgetStatus | String | OK, DAILY_EXCEEDED, MONTHLY_PROJECTED_EXCEEDED, or BOTH_EXCEEDED |
topSpenders | Array | Up to 10 actors ranked by total cost in the window |
topSpenders[].actor | String | Resolved actor slug (e.g., ryanclinton/website-contact-scraper) or actor ID if resolution fails |
topSpenders[].actorId | String | Internal Apify actor ID |
topSpenders[].runs | Integer | Number of runs in the analysis window |
topSpenders[].totalCost | Number | Total USD for this actor in the window, rounded to 4 decimal places |
topSpenders[].avgCostPerRun | Number | Mean cost per run, rounded to 4 decimal places |
anomalies | Array | Up to 20 anomalous runs sorted by multiplier descending |
anomalies[].actor | String | Resolved actor name |
anomalies[].actorId | String | Apify actor ID |
anomalies[].runId | String | Run ID of the anomalous run — use this to inspect it in the console |
anomalies[].cost | Number | Actual cost of the flagged run in USD |
anomalies[].avgCost | Number | Actor's average cost per run in the window |
anomalies[].multiplier | Number | Ratio of run cost to actor average, rounded to 1 decimal place |
anomalies[].reason | String | Plain-language explanation including duration comparison where available |
costTrend | String | stable, increasing, decreasing, or insufficient_data (fewer than 4 runs) |
alertSent | Boolean | Whether a webhook POST was successfully delivered this run |
totalRuns | Integer | Total runs analyzed in the window |
successfulRuns | Integer | Runs with status SUCCEEDED |
failedRuns | Integer | Runs with status FAILED, ABORTED, or TIMED-OUT |
checkedAt | String | ISO 8601 timestamp of when the check was performed |
How much does it cost to monitor Apify spending?
Cost Watchdog uses pay-per-event pricing — you pay $0.05 per check. Platform compute costs are included.
| Scenario | Checks | Cost per check | Total cost |
|---|---|---|---|
| One-off diagnostic | 1 | $0.05 | $0.05 |
| Daily monitoring (1/day) | 30/month | $0.05 | $1.50/month |
| Frequent monitoring (4/day) | 120/month | $0.05 | $6.00/month |
| Hourly monitoring (24/day) | 720/month | $0.05 | $36.00/month |
| Team-level (every 15 min) | 2,880/month | $0.05 | $144.00/month |
You can set a maximum spending limit per run to control costs. The actor stops when your budget is reached.
Most users running Cost Watchdog daily pay $1.50/month. The first anomaly it catches — a runaway actor that would have cost $20-100 in extra compute — pays for more than a year of monitoring. Apify's free tier includes $5 of monthly credits, which covers 100 checks.
Monitor Apify spending using the API
Python
from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("ryanclinton/cost-watchdog").call(run_input={
"apiToken": "YOUR_API_TOKEN",
"dailyBudget": 10.00,
"monthlyBudget": 200.00,
"anomalyThreshold": 3,
"hoursBack": 24,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(f"Spend: ${item['totalSpend']:.2f} | Status: {item['budgetStatus']} | Anomalies: {len(item['anomalies'])}")
for spender in item["topSpenders"][:3]:
print(f" {spender['actor']}: ${spender['totalCost']:.4f} across {spender['runs']} runs (avg ${spender['avgCostPerRun']:.4f})")
for anomaly in item["anomalies"]:
print(f" ANOMALY: {anomaly['actor']} run {anomaly['runId']} — {anomaly['multiplier']}x avg — {anomaly['reason']}")
JavaScript
import { ApifyClient } from "apify-client";
const client = new ApifyClient({ token: "YOUR_API_TOKEN" });
const run = await client.actor("ryanclinton/cost-watchdog").call({
apiToken: "YOUR_API_TOKEN",
dailyBudget: 10.00,
monthlyBudget: 200.00,
anomalyThreshold: 3,
hoursBack: 24,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
const report = items[0];
console.log(`Spend: $${report.totalSpend.toFixed(2)} | Status: ${report.budgetStatus} | Anomalies: ${report.anomalies.length}`);
for (const spender of report.topSpenders.slice(0, 3)) {
console.log(` ${spender.actor}: $${spender.totalCost.toFixed(4)} across ${spender.runs} runs`);
}
for (const anomaly of report.anomalies) {
console.log(` ANOMALY: ${anomaly.actor} — ${anomaly.multiplier}x avg — ${anomaly.reason}`);
}
cURL
# Start the actor run
curl -X POST "https://api.apify.com/v2/acts/ryanclinton~cost-watchdog/runs?token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"apiToken": "YOUR_API_TOKEN",
"dailyBudget": 10.00,
"monthlyBudget": 200.00,
"anomalyThreshold": 3,
"hoursBack": 24
}'
# Fetch results (replace DATASET_ID from the run response above)
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_API_TOKEN&format=json"
How Cost Watchdog works
Phase 1: Run data collection
The actor calls GET /v2/actor-runs with limit=1000 and desc=true (newest first). It paginates through result pages, stopping when a run's startedAt timestamp falls before the analysis cutoff date. A page guard caps pagination at 50 pages (50,000 runs) to prevent unbounded API usage. All HTTP calls use a fetchWithRetry wrapper with a 30-second per-request timeout. HTTP 429 responses trigger exponential backoff starting at 2 seconds: Math.pow(2, attempt) * 2000ms. Other HTTP errors retry with Math.pow(2, attempt) * 1000ms base delay.
Phase 2: Cost calculation and aggregation
For each run, cost is read from usageTotalUsd first. If that field is zero or absent, the actor sums all numeric values in the usageUsd breakdown object (covering ACTOR_COMPUTE_UNITS, DATASET_READS, DATASET_WRITES, KEY_VALUE_STORE_READS, KEY_VALUE_STORE_WRITES, REQUEST_QUEUE_READS, REQUEST_QUEUE_WRITES). Runs are grouped by actId in a Map<string, { runs: RunInfo[], totalCost: number }> structure. Actor IDs are resolved to human-readable slugs via GET /v2/acts/{actorId}, with results cached in an in-memory Map. The top 20 spender actor IDs are resolved in parallel via Promise.all before any sequential await getActorName calls, minimizing total resolution time.
Phase 3: Anomaly detection
Anomaly detection requires at least 2 runs for an actor (to establish a meaningful average). For each qualifying actor, the average cost per run is computed. Every individual run's cost is then divided by that average to produce a multiplier. Any run with multiplier >= anomalyThreshold is flagged. The anomaly record includes a reason string: if both startedAt and finishedAt are available, the reason compares this run's duration in minutes to the actor's average duration across all runs in the window; otherwise it falls back to a raw cost comparison. Anomalies are sorted by multiplier descending and capped at 20 records.
Phase 4: Projection, trend, and alerting
Projected spend is computed by dividing totalSpend by hoursElapsed to get cost-per-hour, then multiplying by 24 (daily) and 720 (monthly). Cost trend splits the window at its midpoint; if second-half spend is more than 1.3x first-half spend the trend is increasing, if less than 0.7x it is decreasing, otherwise stable. Fewer than 4 runs returns insufficient_data. If budgetStatus !== 'OK' or anomalies exist and a webhookUrl is configured, the actor POSTs a JSON payload with a text field (Slack/Discord compatible), an alerts string array, and the full report object. The charge event watchdog-check fires once after successful data push.
Tips for best results
-
Schedule hourly with a Slack webhook for zero-effort monitoring. One check per hour at $0.05 each costs $36/month — far less than a single runaway actor incident. Use Apify Schedules with a cron expression like
0 * * * *. -
Use a 168-hour window (7 days) for cost investigations. The default 24-hour window misses actors that only run a few times per week. A weekly window gives the anomaly detector more runs per actor and improves baseline accuracy.
-
Set the anomaly threshold to 2.5 for development accounts. New actors have less run history, so their cost averages are noisier. A lower threshold catches problems earlier when run counts are small.
-
Pipe the
runIdfrom anomalies directly to the Apify Console URL. Each anomaly record includes arunId— constructhttps://console.apify.com/actors/runs/{runId}to jump directly to that run's logs and storage. -
Combine with Actor Health Monitor for full fleet coverage. Cost Watchdog tracks what things cost; Actor Health Monitor tracks whether they are succeeding. Together they cover the two most important dimensions of actor fleet reliability.
-
Use the
budgetStatusfield in Zapier or Make for conditional branching. A Zapier step that filters onbudgetStatus != "OK"will only trigger actions when spending is genuinely off-track, avoiding alert noise on clean runs. -
Store reports in Google Sheets for trend visualization. Each run produces one JSON record. Push them to a Google Sheet via a Zapier integration to build a 30-day cost history chart without any custom infrastructure.
-
Increase memory to 512MB for accounts with very high run volumes. The default 256MB allocation is sufficient for most accounts. If you consistently have 10,000+ runs in the analysis window, the larger allocation reduces the risk of OOM errors during name resolution.
Combine with other Apify actors
| Actor | How to combine |
|---|---|
| Actor Health Monitor | Run after Cost Watchdog: cost anomalies from this actor point to specific actors; Actor Health Monitor checks their success rates and maintenance status to diagnose the root cause |
| Actor Portfolio Analytics | Use Cost Watchdog's per-actor spend data alongside Portfolio Analytics revenue data to calculate net margin per actor and identify your most profitable workloads |
| Actor Quality Audit | When Cost Watchdog flags a high-spend actor, run Quality Audit on it to check whether its output schema, README, and pricing are configured correctly — misconfigured PPE actors are a common cause of unexpected charges |
| B2B Lead Gen Suite | Monitor the cost per lead generated by the full pipeline; Cost Watchdog's average cost per run feeds directly into your cost-per-acquisition calculations |
| Website Contact Scraper | If contact scraper runs appear in the top spenders list, check their hoursBack window against run frequency to identify batch sizing inefficiencies |
| Google Maps Email Extractor | Maps extraction is one of the higher-cost actor categories; use the per-run average to benchmark against expected $0.15/business pricing and identify over-running jobs |
| Actor Revenue Analytics | Combine spend data from Cost Watchdog with revenue data from Revenue Analytics for a complete profit-and-loss view of your actor portfolio |
Limitations
- In-flight runs are not included — the
usageTotalUsdfield is only populated after a run completes. Runs that are currently executing do not contribute to the spending totals until they finish. - Projections assume constant spend rate — daily and monthly projections use linear extrapolation from the analysis window. Batch workloads that run once per day will produce inaccurate projections if the window captures an unusually active or quiet period.
- Actor name resolution is bounded at 20 for the top spender list — actors outside the top 20 by spend show their raw actor ID rather than a human-readable name. This is a deliberate trade-off to limit API calls.
- Anomaly detection requires at least 2 runs per actor — a single run cannot be compared against an average. New actors with only one run in the window will not appear in the anomaly list even if they were expensive.
- Page cap of 50,000 runs — the 50-page guard means very high-volume accounts (50,000+ runs in the window) may not see all runs captured. Reduce the
hoursBackwindow for these accounts. - No real-time alerting — Cost Watchdog is a batch check, not a streaming monitor. The minimum effective alert latency is the interval between scheduled runs. For hourly scheduling, the worst case is a 59-minute detection delay.
- Webhook delivery is best-effort — if your webhook endpoint is unreachable, the actor logs a warning and continues. There is no retry queue for failed webhook deliveries; the
alertSent: falsefield in the report indicates a delivery failure. - Team and organization accounts require an admin token — if the API token does not have access to all team members' runs, the spending totals will be incomplete.
Integrations
- Zapier — trigger Zapier zaps when
budgetStatusis notOK, pushing spending alerts to email, project management tools, or PagerDuty - Make — build Make scenarios that parse the
anomaliesarray and create Jira tickets or Notion database entries for each flagged run - Google Sheets — append each Cost Watchdog report as a row to build a 30-day spending history chart for the whole team
- Apify API — poll the dataset endpoint programmatically and embed spending data into internal dashboards or cost reporting pipelines
- Webhooks — the built-in
webhookUrlparameter posts Slack/Discord-compatible JSON directly; no Zapier layer needed for simple alert routing - LangChain / LlamaIndex — feed spending reports into LLM-powered cost analysis agents that can recommend which actors to optimize or retire based on cost trends
Troubleshooting
-
Report shows zero spend despite active account — verify the
apiTokenyou entered has access to run history. Tokens scoped to specific actors or with read-only dataset permissions may not have access to the/v2/actor-runsendpoint. Use a full API token from Settings > Integrations. -
Actor names appear as IDs (e.g.,
BCq991ez5HObhS5n0) instead of slugs — actor name resolution can fail if the token does not have permission to read actor details, or if the actor has been deleted. The actor falls back to the raw ID in both cases. This does not affect cost accuracy. -
Webhook alerts not being received — check that your webhook URL accepts POST requests with
Content-Type: application/json. Slack and Discord webhooks work without any additional configuration. For custom endpoints, ensure there is no IP allowlist blocking Apify's egress IPs. ThealertSentfield in the output will befalseif delivery failed. -
Projections seem unrealistically high — a short
hoursBackwindow (e.g., 1 hour) that happens to contain a large batch job will extrapolate that burst rate across 30 days, producing inflated monthly projections. Use a 24-hour or 168-hour window to smooth out bursty workloads. -
Run is taking longer than expected — for accounts with tens of thousands of runs in the window, actor name resolution adds time. Each unique actor requires one API call (resolved in parallel for the top 20). Accounts with 200+ unique actors in the window may take 30-60 seconds. Reduce
hoursBackor accept the longer runtime.
Responsible use
- This actor only accesses your own Apify account data using the API token you provide.
- Your API token should be treated as a secret — do not share run configurations containing your token publicly.
- The token is stored as a secret field in the input schema and is not logged or included in run outputs.
- Do not use this actor with tokens belonging to other users or organizations without explicit authorization.
- For guidance on Apify platform security practices, see the Apify security documentation.
FAQ
How much does Apify spending monitoring cost with Cost Watchdog?
$0.05 per check. Running it once a day costs $1.50/month. Hourly monitoring costs $36/month. Apify's free tier includes $5 of credits, which covers 100 one-off checks.
How accurate are the daily and monthly spending projections?
Projections use linear extrapolation from the analysis window's actual cost-per-hour rate. For accounts with consistent, predictable workloads, accuracy is high. For bursty patterns (large batch jobs that run once a day), use a 24-hour window to capture at least one full cycle and reduce extrapolation error.
Can Cost Watchdog catch a runaway actor in real time?
Not in real time — it is a batch check, not a streaming monitor. Schedule it to run every hour for near-real-time detection. With hourly scheduling, any runaway actor will be caught and alerted within 60 minutes.
What does the anomaly threshold setting actually do?
It sets the cost multiplier at which a single run is flagged as anomalous. The default of 3 means: flag any run that costs 3x or more than that actor's average cost per run in the window. Set it to 2 for more sensitive detection or 5 to only catch major spikes.
Does Cost Watchdog work with Pay-Per-Event (PPE) actors?
Yes. The usageTotalUsd field returned by the Apify run API includes all charges — compute units, storage operations, and PPE event charges. Cost Watchdog reads this total directly, so PPE costs are fully captured regardless of how the actor is priced.
How is Cost Watchdog different from Apify's native spending limits?
Apify's native spending limits stop actors from running when a budget is hit. Cost Watchdog provides visibility and alerting before limits are hit — showing you which actors are trending upward, projecting next month's bill, and flagging individual anomalous runs so you can fix the root cause rather than just getting stopped.
Can I monitor a team account with Cost Watchdog?
Yes. Use an admin-level API token for the team account. The actor fetches runs via /v2/actor-runs which returns all runs the token has access to. A non-admin token may only see the token owner's runs and produce an incomplete picture.
What happens if no runs are found in the analysis window?
The actor returns a valid report with all spend fields set to zero and budgetStatus: "OK". This is normal behavior for accounts with no activity in the selected window. No webhook alert is sent.
How many runs can Cost Watchdog analyze in a single check?
Up to 50,000 runs (50 pages of 1,000 runs each). For accounts exceeding this volume in the analysis window, the results are truncated and a warning is logged. Reduce hoursBack for very high-volume accounts.
Is it safe to give Cost Watchdog my API token?
The token is marked as isSecret: true in the input schema, which means it is encrypted at rest and never displayed in the Apify Console after submission. The actor only uses it for read API calls to /v2/actor-runs and /v2/acts/{id}. It does not write data, create actors, or modify account settings.
Can I schedule Cost Watchdog to run automatically?
Yes — and this is the recommended approach. In the Apify Console, go to Schedules, create a new schedule pointing to Cost Watchdog, and set a cron expression (e.g., 0 * * * * for hourly). Add your Slack webhook URL to the input and set budget thresholds. You will receive automated alerts without any manual checks.
How is the cost trend calculated?
The analysis window is split at its midpoint into two equal halves. Total spend in each half is compared: if the second half costs more than 1.3x the first half, the trend is increasing; if less than 0.7x, it is decreasing; otherwise stable. Fewer than 4 runs returns insufficient_data.
Help us improve
If you encounter issues, you can help us debug faster by enabling run sharing in your Apify account:
- Go to Account Settings > Privacy
- Enable Share runs with public Actor creators
This lets us see your run details when something goes wrong, so we can fix issues faster. Your data is only visible to the actor developer, not publicly.
Support
Found a bug or have a feature request? Open an issue in the Issues tab on this actor's page. For custom solutions or enterprise integrations, reach out through the Apify platform.
How it works
Configure
Set your parameters in the Apify Console or pass them via API.
Run
Click Start, trigger via API, webhook, or set up a schedule.
Get results
Download as JSON, CSV, or Excel. Integrate with 1,000+ apps.
Use cases
Sales Teams
Build targeted lead lists with verified contact data.
Marketing
Research competitors and identify outreach opportunities.
Data Teams
Automate data collection pipelines with scheduled runs.
Developers
Integrate via REST API or use as an MCP tool in AI workflows.
Related actors
Bulk Email Verifier
Verify email deliverability at scale. MX record validation, SMTP mailbox checks, disposable and role-based detection, catch-all flagging, and confidence scoring. No external API costs.
GitHub Repository Search
Search GitHub repositories by keyword, language, topic, stars, forks. Sort by stars, forks, or recently updated. Returns metadata, topics, license, owner info, URLs. Free API, optional token for higher limits.
Website Content to Markdown
Convert any website to clean Markdown for RAG pipelines, LLM training, and AI apps. Crawls pages, strips boilerplate, preserves headings, tables, and code blocks. GFM support.
Website Tech Stack Detector
Detect 100+ web technologies on any website. Identifies CMS, frameworks, analytics, marketing tools, chat widgets, CDNs, payment systems, hosting, and more. Batch-analyze multiple sites with version detection and confidence scoring.