CL

clay-cost-tuning

Helps reduce Clay spending by connecting custom API keys, optimizing enrichment depth, and setting budget alerts.

Install

mkdir -p .claude/skills/clay-cost-tuning && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4753" && unzip -o skill.zip -d .claude/skills/clay-cost-tuning && rm skill.zip

Installs to .claude/skills/clay-cost-tuning

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Optimize Clay credit spending with provider key management, waterfall
69 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Connect custom provider API keys
  • Optimize waterfall enrichment depth
  • Pre-filter input data to avoid credit waste
  • Perform sampling before full enrichment runs
  • Implement credit budget alerts

How it works

The skill reduces costs by connecting personal API keys to bypass Clay-managed credit charges and by implementing pre-filtering and sampling to minimize unnecessary lookups.

Inputs & outputs

You give it
Clay table data and credit usage metrics
You get back
Optimized enrichment configuration and budget alerts

When to use clay-cost-tuning

  • Connect custom provider API keys
  • Optimize waterfall enrichment depth
  • Implement credit budget monitoring
  • Reduce data credit usage

About this skill

Clay Cost Tuning

Overview

Reduce Clay data enrichment spending by connecting your own API keys (70-80% savings), optimizing waterfall depth, improving input data quality, and implementing budget controls. Clay's March 2026 pricing split credits into Data Credits and Actions, changing the optimization calculus.

Prerequisites

  • Clay account with visibility into credit consumption
  • Understanding of which enrichment columns are in your tables
  • Access to Clay Settings > Plans & Billing

Instructions

Step 1: Connect Your Own Provider API Keys (Biggest Savings)

This is the single most impactful cost reduction. Clay charges 0 Data Credits when you use your own API keys:

ProviderClay-Managed CostOwn Key CostAnnual Savings (10K rows/mo)
Apollo2 credits/lookup0 credits~240K credits/year
Clearbit2-5 credits0 credits~360K credits/year
Hunter.io2 credits0 credits~240K credits/year
Prospeo2 credits0 credits~240K credits/year
People Data Labs3 credits0 credits~360K credits/year
ZoomInfo5-13 credits0 credits~1M+ credits/year

Setup: Go to Settings > Connections in Clay, click Add Connection, and paste your provider API key. All enrichments using that provider will consume 0 Clay credits (1 Action is still consumed per enrichment).

Step 2: Optimize Waterfall Enrichment Depth

Each waterfall step costs credits (if using Clay-managed keys) and time:

# Expensive waterfall (5 providers, 10-15 credits/row):
expensive:
  - apollo:      2 credits
  - hunter:      2 credits
  - prospeo:     2 credits
  - dropcontact: 3 credits
  - findymail:   3 credits
  total_max: 12 credits/row
  coverage: ~92%

# Optimized waterfall (2 providers, 4 credits/row):
optimized:
  - apollo:      2 credits  # Highest coverage provider first
  - hunter:      2 credits  # Strong backup
  total_max: 4 credits/row
  coverage: ~83%
  savings: "67% credit reduction, ~9% coverage loss"

March 2026 change: Failed lookups no longer cost Data Credits. This makes wider waterfalls less expensive than before, since you only pay when data is actually found.

Step 3: Pre-Filter Input Data

Credits wasted on unenrichable rows are the most common cost leak:

// src/clay/cost-filter.ts
function estimateCreditCost(rows: any[], creditsPerRow: number): {
  filteredRows: any[];
  estimatedCredits: number;
  savings: number;
} {
  const personalDomains = new Set([
    'gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', 'icloud.com',
  ]);

  const filtered = rows.filter(row => {
    if (!row.domain?.includes('.')) return false;
    if (personalDomains.has(row.domain)) return false;
    if (!row.first_name || !row.last_name) return false;
    return true;
  });

  // Deduplicate
  const seen = new Set<string>();
  const deduped = filtered.filter(row => {
    const key = `${row.domain}:${row.first_name}:${row.last_name}`.toLowerCase();
    if (seen.has(key)) return false;
    seen.add(key);
    return true;
  });

  return {
    filteredRows: deduped,
    estimatedCredits: deduped.length * creditsPerRow,
    savings: (rows.length - deduped.length) * creditsPerRow,
  };
}

// Usage
const { filteredRows, estimatedCredits, savings } = estimateCreditCost(rawLeads, 6);
console.log(`Will process ${filteredRows.length} rows (${estimatedCredits} credits)`);
console.log(`Saved ${savings} credits by pre-filtering`);

Step 4: Use Sampling Before Full Runs

Test enrichment quality on a small sample before committing credits to the full list:

// src/clay/sampler.ts
function sampleForTest(rows: any[], sampleSize = 100): {
  sample: any[];
  remaining: any[];
  estimatedTotalCredits: number;
} {
  // Random sample for representative results
  const shuffled = [...rows].sort(() => Math.random() - 0.5);
  const sample = shuffled.slice(0, sampleSize);
  const remaining = shuffled.slice(sampleSize);

  return {
    sample,
    remaining,
    estimatedTotalCredits: rows.length * 6, // Estimate 6 credits/row average
  };
}

// Workflow:
// 1. Send sample (100 rows) to Clay test table
// 2. Check hit rate after enrichment completes
// 3. If hit rate > 60%, proceed with full list
// 4. If hit rate < 40%, clean input data first

Step 5: Implement Credit Budget Alerts

// src/clay/budget-monitor.ts
interface CreditBudget {
  monthlyLimit: number;      // From your plan
  dailyThreshold: number;    // Alert if exceeded
  perTableMax: number;       // Cap per table
}

const PLAN_BUDGETS: Record<string, CreditBudget> = {
  launch:     { monthlyLimit: 2_500, dailyThreshold: 125, perTableMax: 500 },
  growth:     { monthlyLimit: 6_000, dailyThreshold: 300, perTableMax: 1_500 },
  enterprise: { monthlyLimit: 50_000, dailyThreshold: 2_500, perTableMax: 10_000 },
};

class BudgetMonitor {
  private dailyUsage = 0;
  private monthlyUsage = 0;
  private tableUsage = new Map<string, number>();

  constructor(private budget: CreditBudget) {}

  recordUsage(tableId: string, credits: number) {
    this.dailyUsage += credits;
    this.monthlyUsage += credits;
    this.tableUsage.set(tableId, (this.tableUsage.get(tableId) || 0) + credits);

    // Check thresholds
    if (this.dailyUsage > this.budget.dailyThreshold) {
      console.warn(`ALERT: Daily credit usage (${this.dailyUsage}) exceeds threshold (${this.budget.dailyThreshold})`);
    }
    if (this.monthlyUsage > this.budget.monthlyLimit * 0.8) {
      console.warn(`ALERT: Monthly credits at ${((this.monthlyUsage / this.budget.monthlyLimit) * 100).toFixed(0)}%`);
    }
    if ((this.tableUsage.get(tableId) || 0) > this.budget.perTableMax) {
      console.error(`STOP: Table ${tableId} exceeded per-table cap (${this.budget.perTableMax} credits)`);
    }
  }
}

Step 6: Credit-Per-Lead Cost Calculator

function calculateCostPerLead(
  totalCredits: number,
  totalRows: number,
  rowsWithEmail: number,
  rowsPushedToCRM: number,
): void {
  console.log('=== Clay Cost Analysis ===');
  console.log(`Credits used: ${totalCredits}`);
  console.log(`Cost per row processed: ${(totalCredits / totalRows).toFixed(1)} credits`);
  console.log(`Cost per email found: ${(totalCredits / Math.max(rowsWithEmail, 1)).toFixed(1)} credits`);
  console.log(`Cost per CRM lead: ${(totalCredits / Math.max(rowsPushedToCRM, 1)).toFixed(1)} credits`);
  console.log(`Email find rate: ${((rowsWithEmail / totalRows) * 100).toFixed(1)}%`);
  console.log(`Qualification rate: ${((rowsPushedToCRM / totalRows) * 100).toFixed(1)}%`);
}

Error Handling

IssueCauseSolution
Credits burning fastWaterfall enriching all providersEnable "stop on first result", reduce depth
Low hit rate (<30%)Bad input dataFilter personal domains, validate before import
Unexpected chargesNew column added with auto-runReview all auto-run columns monthly
Credit rollover cappedBalance exceeds 2x monthlyUse credits before they cap out

Resources

Next Steps

For reference architecture patterns, see clay-reference-architecture.

When not to use it

  • Do not use for non-credit based enrichment services

Prerequisites

Clay account with visibility into credit consumptionAccess to Clay Settings > Plans & Billing

Limitations

  • Failed lookups no longer cost Data Credits
  • 1 Action is still consumed per enrichment

How it compares

This approach uses programmatic filtering and custom API keys to reduce costs, whereas manual management relies on UI-based settings.

Compared to similar skills

clay-cost-tuning side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
clay-cost-tuning (this skill)127dNo flagsIntermediate
agent-performance-benchmarker36moNo flagsAdvanced
clay-observability127dCautionIntermediate
firecrawl-cost-tuning127dCautionIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

agent-performance-benchmarker

ruvnet

Agent skill for performance-benchmarker - invoke with $agent-performance-benchmarker

315

clay-observability

jeremylongshore

Set up comprehensive observability for Clay integrations with metrics, traces, and alerts. Use when implementing monitoring for Clay operations, setting up dashboards, or configuring alerting for Clay integration health. Trigger with phrases like "clay monitoring", "clay metrics", "clay observability", "monitor clay", "clay alerts", "clay tracing".

11

firecrawl-cost-tuning

jeremylongshore

Optimize FireCrawl costs through tier selection, sampling, and usage monitoring. Use when analyzing FireCrawl billing, reducing API costs, or implementing usage monitoring and budget alerts. Trigger with phrases like "firecrawl cost", "firecrawl billing", "reduce firecrawl costs", "firecrawl pricing", "firecrawl expensive", "firecrawl budget".

11

azure-monitor-query-java

microsoft

Azure Monitor Query SDK for Java. Execute Kusto queries against Log Analytics workspaces and query metrics from Azure resources. Triggers: "LogsQueryClient java", "MetricsQueryClient java", "kusto query java", "log analytics java", "azure monitor query java". Note: This package is deprecated. Migrate to azure-monitor-query-logs and azure-monitor-query-metrics.

01

klingai-usage-analytics

jeremylongshore

Build usage analytics and reporting for Kling AI. Use when tracking generation patterns, analyzing costs, or creating dashboards. Trigger with phrases like 'klingai analytics', 'kling ai usage report', 'klingai metrics', 'video generation stats'.

10

windsurf-observability

jeremylongshore

Set up comprehensive observability for Windsurf integrations with metrics, traces, and alerts. Use when implementing monitoring for Windsurf operations, setting up dashboards, or configuring alerting for Windsurf integration health. Trigger with phrases like "windsurf monitoring", "windsurf metrics", "windsurf observability", "monitor windsurf", "windsurf alerts", "windsurf tracing".

10

Search skills

Search the agent skills registry