/alchemy-pack:alchemy-cost-tuningfrom alchemy-pack
Optimize Alchemy API costs through CU budgeting, caching, and plan selection. Use when analyzing Alchemy billing or reducing Compute Unit consumption.
Ships in alchemy-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.
None: SKILL.md is the whole skill.
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 | 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 |
| 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 |
// src/cost/cu-monitor.ts
const CU_COSTS: Record<string, number> = {
'eth_blockNumber': 10, 'eth_getBalance': 19, 'eth_call': 26,
'getTokenBalances': 50, 'getNftsForOwner': 50, 'getTokenMetadata': 50,
'getAssetTransfers': 150, 'getNftMetadataBatch': 50,
};
class CuMonitor {
private usage: Array<{ method: string; cu: number; timestamp: number }> = [];
record(method: string): void {
this.usage.push({ method, cu: CU_COSTS[method] || 26, timestamp: Date.now() });
}
getHourlyReport(): { totalCu: number; byMethod: Record<string, number> } {
const cutoff = Date.now() - 3600000;
const recent = this.usage.filter(u => u.timestamp > cutoff);
const byMethod: Record<string, number> = {};
let totalCu = 0;
for (const u of recent) {
byMethod[u.method] = (byMethod[u.method] || 0) + u.cu;
totalCu += u.cu;
}
return { totalCu, byMethod };
}
getMonthlyProjection(): { projectedMonthly: number; planRecommendation: string } {
const hourly = this.getHourlyReport();
const projectedMonthly = hourly.totalCu * 24 * 30;
let recommendation = 'Free';
if (projectedMonthly > 300_000_000) recommendation = 'Growth';
if (projectedMonthly > 1_200_000_000) recommendation = 'Scale';
return { projectedMonthly, planRecommendation: recommendation };
}
}
export { CuMonitor };
// src/cost/optimized-client.ts
import { Alchemy, Network } from 'alchemy-sdk';
const cache = new Map<string, { data: any; expiry: number }>();
// Cache token metadata aggressively (rarely changes)
async function getTokenMetadataCached(alchemy: Alchemy, contract: string) {
const key = `metadata:${contract}`;
const cached = cache.get(key);
if (cached && cached.expiry > Date.now()) return cached.data;
const data = await alchemy.core.getTokenMetadata(contract);
cache.set(key, { data, expiry: Date.now() + 86400000 }); // 24h cache
return data;
}
// Use batch instead of individual NFT metadata calls
// 1 batch call (50 CU) vs 100 individual calls (5000 CU)
async function getNftMetadataOptimized(
alchemy: Alchemy,
tokens: Array<{ contractAddress: string; tokenId: string }>
) {
const BATCH_SIZE = 100;
const results = [];
for (let i = 0; i < tokens.length; i += BATCH_SIZE) {
const batch = tokens.slice(i, i + BATCH_SIZE);
const batchResults = await alchemy.nft.getNftMetadataBatch(batch);
results.push(...batchResults);
}
return results;
}
// For staying within Free tier (330 CU/sec, 300M CU/month):
// 1. Cache eth_blockNumber (saves 10 CU per redundant call)
// 2. Cache token metadata (saves 50 CU per redundant call)
// 3. Use getNftMetadataBatch instead of getNftMetadata (100x savings)
// 4. Avoid getAssetTransfers loops (150 CU each — cache results)
// 5. Use WebSockets instead of polling (one connection vs repeated calls)
// 6. Rate-limit user-facing endpoints to prevent CU bursts
For architecture design, see alchemy-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
18 skills in this plugin
/alchemy-ci-integrationConfigure CI/CD pipeline for Alchemy-powered Web3 applications.
Use when setting up automated testing with Hardhat forks,
smart contract verification, or testnet deployment pipelines.
Trigger: "alchemy CI", "alchemy GitHub Actions", "web3 CI/CD pipeline".
/alchemy-common-errorsDiagnose and fix common Alchemy SDK and Web3 API errors.
Use when encountering rate limits, RPC failures, invalid parameters,
or blockchain query errors with the Alchemy SDK.
Trigger: "alchemy error", "alchemy not working", "alchemy 429",
"alchemy debug", "fix alchemy issue".
/alchemy-core-workflow-aBuild a complete wallet portfolio tracker using Alchemy Enhanced APIs.
Use when implementing token balance dashboards, NFT galleries,
transaction history views, or wallet analytics applications.
Trigger: "alchemy wallet tracker", "alchemy portfolio", "alchemy token dashboard",
"alchemy transaction history", "build dApp with alchemy".
/alchemy-core-workflow-bBuild NFT collection explorer and smart contract interaction with Alchemy.
Use when fetching NFT metadata, building galleries, reading contract state,
or implementing NFT marketplace features.
Trigger: "alchemy NFT", "alchemy smart contract", "alchemy collection",
"alchemy NFT metadata", "alchemy contract read".
/alchemy-debug-bundleCollect Alchemy SDK debug evidence for troubleshooting and support tickets.
Use when encountering persistent issues, preparing support tickets,
or debugging blockchain query failures.
Trigger: "alchemy debug bundle", "alchemy support ticket", "alchemy diagnostics".
/alchemy-deploy-integrationDeploy Alchemy-powered Web3 applications to Vercel, Cloud Run, and AWS.
Use when deploying dApps with server-side Alchemy SDK access,
configuring API key secrets, or setting up RPC proxy endpoints.
Trigger: "deploy alchemy", "alchemy Vercel", "alchemy Cloud Run",
"alchemy production deploy", "dApp deploy".
npx claudepluginhub flight505/skill-forge --plugin alchemy-packOther plugins' skills for the same job