/apify-pack:apify-cost-tuningfrom apify-pack
Optimizes Apify platform costs through memory tuning, compute unit management, and proxy budgeting. Helps analyze billing, reduce Actor run costs, and set budget alerts.
Ships in apify-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Apify charges on three axes: compute units (CU), proxy traffic (GB), and storage. One CU = 1 GB of memory running for 1 hour, so cost scales with both memory allocation and run duration. This skill walks the investigate → tune → guard loop that finds where spend is going, cuts it at the biggest lever (memory), and installs guardrails so it stays down.
Full pricing tables (plan CU prices, proxy rates, storage rules) live in pricing-model.md.
APIFY_TOKEN set in the environment.apify-client package installed (npm install apify-client).The workflow is six steps. Each is summarized here with its core lever; the full, runnable code for every step is in implementation.md.
Analyze current costs — roll up the last N days of runs into total CU, USD, and duration, and surface the single most expensive run:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const { items: runs } = await client.actor(actorId).runs().list({ limit: 1000, desc: true });
const totalUsd = runs.reduce((s, r) => s + (r.usageTotalUsd ?? 0), 0);
Reduce memory allocation (biggest lever) — sweep memory from 4096 MB down to 256 MB and stop at the first failure to find the sweet spot. Most CheerioCrawler Actors are over-provisioned. Sweet spots: simple Cheerio 256-512 MB, complex 512-1024 MB, Playwright 2048-4096 MB.
Optimize crawl duration — higher maxConcurrency, tighter
requestHandlerTimeoutSecs, a maxRequestsPerCrawl cap, fewer retries, and
selective enqueueLinks. Faster crawls consume fewer CUs.
Minimize proxy costs — prefer datacenter (free with plan), only reach for
residential when a site blocks it, block images/fonts/CSS to save residential GB,
and reuse proxy sessions with useSessionPool.
Cost guard for runaway Actors — start the run, poll usageTotalUsd every 30s,
and .abort() once spend crosses a hard cap.
Monitor monthly usage — iterate every Actor's runs since the 1st of the month and print a cost-descending report so the top spenders are obvious.
See full walkthrough for the complete code of each step, including the memory sweep, proxy hooks, budget guard, and monthly report.
Running this skill produces:
maxRequestsPerCrawl set to prevent runaway crawlsmaxConcurrency tuned (higher = faster = fewer CUs)| Issue | Cause | Solution |
|---|---|---|
| Unexpected cost spike | No maxRequestsPerCrawl | Always set an upper bound |
| High residential proxy cost | Scraping images/fonts | Block non-essential resources |
| Over-provisioned memory | Default 1024MB | Profile and reduce to minimum |
| Too many scheduled runs | Aggressive cron | Reduce frequency if data freshness allows |
Three worked scenarios chain the steps against concrete symptoms — a CheerioCrawler bill that tripled, runaway residential-proxy GB, and guarding a brand-new Actor. Each shows the full investigate → tune → verify loop. See examples.md.
Quick guard example — abort any run that exceeds $0.50:
// runWithBudget polls usageTotalUsd every 30s and aborts past the cap
const run = await runWithBudget('user/scraper', input, 0.50);
For architecture patterns, see apify-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
apify, cost-optimization, memory-tuning, proxy-budgeting, budget-alerts
18 skills in this plugin
/apify-ci-integrationConfigure CI/CD pipelines for Apify Actor builds and deployments.
Use when automating Actor deployment via GitHub Actions, running
integration tests against the live Apify API, or building CI/CD for
scrapers that push to the Apify platform.
Trigger with "apify CI", "apify GitHub Actions", "apify automated deploy",
"CI apify", "apify pipeline", "auto deploy actor".
/apify-common-errorsDiagnose and fix common Apify Actor and API errors.
Use when an Apify run fails, an API call returns 401/403/404/413/429,
a proxy connection drops, an Actor build breaks, or a scrape hits an
anti-bot block, and you need the cause plus a copy-paste fix.
Trigger with "apify error", "fix apify", "actor failed",
"apify not working", "debug apify", "apify 429".
/apify-core-workflow-aBuild a complete web scraping Actor with Crawlee and deploy to Apify.
Use when you need end-to-end web scraping on Apify: defining an input schema, building a router-based Crawlee crawler, extracting structured data, storing results in a dataset, testing locally, and deploying the Actor to the platform.
Trigger with "apify scrape website", "build apify actor", "crawlee scraper", "apify main workflow".
/apify-core-workflow-bManage Apify datasets, key-value stores, and request queues programmatically,
and orchestrate multi-Actor pipelines.
Use when you need to read or write Apify datasets, export scraped data to
CSV/JSON/XLSX, store config or binary artifacts in a key-value store, manage a
resumable request queue, chain Actors into a scrape → transform → export
pipeline, or monitor Actor run status and cost.
Trigger with "apify dataset", "apify key-value store", "apify storage",
"export apify data", "apify pipeline", "apify request queue".
/apify-debug-bundleCollect Apify debug evidence for support tickets and troubleshooting.
Use when an Actor run has failed, is stuck, or produced empty output and
you need to gather run metadata, logs, dataset samples, and environment
info before opening a support ticket.
Trigger with "apify debug", "apify support bundle", "collect apify logs",
"apify diagnostic", "apify run failed why".
/apify-deploy-integrationDeploy Apify Actors and integrate scraping into external applications.
Use when deploying an Actor to the platform, integrating Actor results into a web app (Next.js, Express), wiring webhooks, or scheduling scraping pipelines.
Trigger with "deploy apify actor", "apify Vercel integration", "apify production deploy", "integrate apify results", "apify API endpoint".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin apify-packOther plugins' skills for the same job