apify-cost-tuning
'Optimize Apify platform costs through memory tuning, compute unit
Install / Use
npx skills add jeremylongshore/tons-of-skills-marketplace --skill apify-cost-tuningInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of apify-cost-tuning
apify-cost-tuning scores 84/100 on our quality scale, 1576th of 2,607 Automation skills we index.
Its SKILL.md is 5.5 KB long, well organised into 10 sections with 1 code example: a solid amount of guidance for an agent.
With 2,785 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 6 days ago, so apify-cost-tuning is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
apify-cost-tuning compared with similar skills
All 4 of these similar skills score higher than apify-cost-tuning; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| apify-cost-tuning (this skill)by jeremylongshore | 84 | 2.8k | 6d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 86.3k | 14d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.1k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 73.6k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 84.6k | today | MCP Server |
Frequently asked questions
- How do I install apify-cost-tuning?
- Run
npx skills add jeremylongshore/tons-of-skills-marketplace --skill apify-cost-tuning. The install tabs above show the steps for each supported agent. - Which AI agents does apify-cost-tuning work with?
- It is written for Claude Code, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is apify-cost-tuning safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is apify-cost-tuning still maintained?
- The repository was last updated 6 days ago, so apify-cost-tuning is actively maintained.
Skill content
View source on GitHubname: apify-cost-tuning description: 'Optimize Apify platform costs through memory tuning, compute unit management, and proxy budgeting. Use when analyzing Apify billing, reducing Actor run costs, or implementing usage monitoring and budget alerts. Trigger with "apify cost", "apify billing", "reduce apify costs", "apify pricing", "apify expensive", "apify budget", "compute units".' allowed-tools: Read, Grep version: 1.5.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:
- saas
- scraping
- automation
- apify compatibility: Designed for Claude Code
Apify Cost Tuning
Overview
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.
Prerequisites
- An Apify account with API access and
APIFY_TOKENset in the environment. - The
apify-clientpackage installed (npm install apify-client). - At least one Actor with run history to analyze.
Instructions
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, tighterrequestHandlerTimeoutSecs, amaxRequestsPerCrawlcap, fewer retries, and selectiveenqueueLinks. 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
usageTotalUsdevery 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.
Output
Running this skill produces:
- A per-Actor cost analysis (runs, total CU, total USD, avg CU/run, avg cost/run, most expensive run) for a chosen lookback window.
- A memory profile table mapping memory settings to status, duration, CU, and USD so you can pick the cheapest allocation that still succeeds.
- A monthly cost report ranking every Actor by spend, with a grand total.
- Tuned Actor configuration (reduced memory, capped crawls, proxy resource blocking) and an optional budget guard that aborts runs exceeding a USD ceiling.
Cost Optimization Checklist
- [ ] Memory profiled (start low: 256-512MB for Cheerio)
- [ ]
maxRequestsPerCrawlset to prevent runaway crawls - [ ] Datacenter proxy used when possible (free with plan)
- [ ] Residential proxy: images/CSS/fonts blocked to save bandwidth
- [ ]
maxConcurrencytuned (higher = faster = fewer CUs) - [ ] Scheduled runs have appropriate frequency (don't over-scrape)
- [ ] Cost guard implemented for expensive runs
- [ ] Monthly usage reviewed
Error Handling
| 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 |
Examples
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);
Resources
- Apify Pricing
- Usage & Resources
- Compute Unit Calculator
- pricing-model.md — full pricing tables (local)
- implementation.md — complete step-by-step code (local)
- examples.md — worked cost-tuning scenarios (local)
Next Steps
For architecture patterns, see apify-reference-architecture.
Related Skills
Agent-Reach
86.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.1kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ruflo
73.6k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Scrapling
84.6k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
