alchemy-cost-tuning

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".

1,868 stars

Best use case

alchemy-cost-tuning is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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".

Teams using alchemy-cost-tuning should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/alchemy-cost-tuning/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/alchemy-pack/skills/alchemy-cost-tuning/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/alchemy-cost-tuning/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How alchemy-cost-tuning Compares

Feature / Agentalchemy-cost-tuningStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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

```typescript
// 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 };
```

### Step 2: Cost-Optimized Client Wrapper

```typescript
// 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;
}
```

### Step 3: Free Tier Optimization Checklist

```typescript
// 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
```

## Output

- CU usage monitor with hourly reports and plan projections
- Cost-optimized client with aggressive caching
- Batch operations reducing CU consumption by 100x
- Free tier optimization checklist

## Resources

- [Alchemy Pricing](https://www.alchemy.com/pricing)
- [Alchemy Compute Units](https://www.alchemy.com/docs/reference/compute-unit-costs)

## Next Steps

For architecture design, see `alchemy-reference-architecture`.

Related Skills

workhuman-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman performance tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman performance tuning".

workhuman-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman cost tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman cost tuning".

wispr-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow performance tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr performance tuning".

wispr-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow cost tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr cost tuning".

windsurf-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Windsurf IDE performance: indexing speed, Cascade responsiveness, and memory usage. Use when Windsurf is slow, indexing takes too long, Cascade times out, or the IDE uses too much memory. Trigger with phrases like "windsurf slow", "windsurf performance", "optimize windsurf", "windsurf memory", "cascade slow", "indexing slow".

windsurf-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Windsurf licensing costs through seat management, tier selection, and credit monitoring. Use when analyzing Windsurf billing, reducing per-seat costs, or implementing usage monitoring and budget controls. Trigger with phrases like "windsurf cost", "windsurf billing", "reduce windsurf costs", "windsurf pricing", "windsurf budget".

webflow-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Webflow API performance with response caching, bulk endpoint batching, CDN-cached live item reads, pagination optimization, and connection pooling. Use when experiencing slow API responses or optimizing request throughput. Trigger with phrases like "webflow performance", "optimize webflow", "webflow latency", "webflow caching", "webflow slow", "webflow batch".

webflow-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Webflow costs through plan selection, CDN read optimization, bulk endpoint usage, and API usage monitoring with budget alerts. Use when analyzing Webflow billing, reducing API costs, or implementing usage monitoring for Webflow integrations. Trigger with phrases like "webflow cost", "webflow billing", "reduce webflow costs", "webflow pricing", "webflow budget".

vercel-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Vercel deployment performance with caching, bundle optimization, and cold start reduction. Use when experiencing slow page loads, optimizing Core Web Vitals, or reducing serverless function cold start times. Trigger with phrases like "vercel performance", "optimize vercel", "vercel latency", "vercel caching", "vercel slow", "vercel cold start".

vercel-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Vercel costs through plan selection, function efficiency, and usage monitoring. Use when analyzing Vercel billing, reducing function execution costs, or implementing spend management and budget alerts. Trigger with phrases like "vercel cost", "vercel billing", "reduce vercel costs", "vercel pricing", "vercel expensive", "vercel budget".

veeva-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault performance tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva performance tuning".

veeva-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault cost tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva cost tuning".