| name | alchemy-cost-tuning |
| description | Optimize Alchemy API costs through CU budgeting, caching, and plan selection.
Use when analyzing Alchemy billing, reducing Compute Unit consumption,
or choosing the right plan for your dApp traffic.
Trigger: "alchemy cost", "alchemy pricing", "alchemy CU budget",
"alchemy billing optimization", "alchemy free tier limits".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*) |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","blockchain","web3","alchemy","cost-optimization"] |
| compatibility | Designed for Claude Code |
Alchemy Cost Tuning
Overview
Alchemy pricing is based on Compute Units (CU). Different API methods have different CU costs. Optimize by caching, batching, choosing cheaper methods, and right-sizing your plan.
Plan Comparison
| Plan | CU/sec | Monthly CU | Price | Best For |
|---|
| Free | 330 | 300M | $0 | Dev/prototyping |
| Growth | 660 | 1.2B | $49/mo | Small dApps |
| Scale | Custom | Custom | Custom | High-traffic apps |
CU Cost Reference (Top Methods)
| Method | CU | Optimization |
|---|
eth_blockNumber | 10 | Cache 12s (1 block) |
eth_getBalance | 19 | Cache 30s |
eth_call | 26 | Cache based on use case |
getTokenBalances | 50 | Cache 60s; batch addresses |
getNftsForOwner | 50 | Cache 5 min |
getTokenMetadata | 50 | Cache 24h (rarely changes) |
getAssetTransfers | 150 | Cache aggressively; paginate |
getNftMetadataBatch | 50 | Use batch over individual calls |
Instructions
Step 1: CU Usage Monitor
const CU_COSTS: Record<string, number> = {
'eth_blockNumber': 10, 'eth_getBalance': 19, 'eth_call': ,
: , : , : ,
: , : ,
};
{
: <{ : ; : ; : }> = [];
(: ): {
..({ method, : [method] || , : .() });
}
(): { : ; : <, > } {
cutoff = .() - ;
recent = ..( u. > cutoff);
: <, > = {};
totalCu = ;
( u recent) {
byMethod[u.] = (byMethod[u.] || ) + u.;
totalCu += u.;
}
{ totalCu, byMethod };
}
(): { : ; : } {
hourly = .();
projectedMonthly = hourly. * * ;
recommendation = ;
(projectedMonthly > ) recommendation = ;
(projectedMonthly > ) recommendation = ;
{ projectedMonthly, : recommendation };
}
}
{ };