apollo-cost-tuning
Apollo.ioのコスト削減とクレジット使用量の最適化ができます。Apollo クレジットの管理、API コストの削減、サブスクリプション使用量の最適化が必要な場合にご利用ください。「apollo cost」「apollo credits」「apollo billing」「reduce apollo costs」「apollo usage」といったフレーズで起動できます。
description の原文を見る
Optimize Apollo.io costs and credit usage. Use when managing Apollo credits, reducing API costs, or optimizing subscription usage. Trigger with phrases like "apollo cost", "apollo credits", "apollo billing", "reduce apollo costs", "apollo usage".
SKILL.md 本文
Apollo コスト調整
概要
効率的なクレジット使用、スマートキャッシング、重複排除、使用状況監視を通じて Apollo.io のコストを最適化します。
Apollo 料金体系
| 機能 | クレジットコスト | 備考 |
|---|---|---|
| 人材検索 | 1 クレジット/結果 | ページネーション結果 |
| メールリバール | 1 クレジット/メール | 初回リバールのみ |
| 人物エンリッチメント | 1 クレジット/人 | 新鮮なデータ |
| 組織エンリッチメント | 1 クレジット/組織 | 企業データ |
| シーケンスメール | 含まれる | プラン制限あり |
| エクスポート | 様々 | 一括操作 |
コスト削減戦略
1. アグレッシブキャッシング
// src/lib/apollo/cost-aware-cache.ts
import { LRUCache } from 'lru-cache';
interface CachedContact {
data: any;
fetchedAt: Date;
creditCost: number;
}
class CostAwareCache {
private cache: LRUCache<string, CachedContact>;
private creditsSaved = 0;
constructor() {
this.cache = new LRUCache({
max: 10000,
ttl: 7 * 24 * 60 * 60 * 1000, // 7 days for contact data
});
}
getContact(email: string): CachedContact | null {
const cached = this.cache.get(email);
if (cached) {
this.creditsSaved++;
console.log(`Cache hit for ${email}. Total credits saved: ${this.creditsSaved}`);
}
return cached || null;
}
setContact(email: string, data: any, creditCost: number = 1): void {
this.cache.set(email, {
data,
fetchedAt: new Date(),
creditCost,
});
}
getStats() {
return {
entriesCount: this.cache.size,
creditsSaved: this.creditsSaved,
estimatedSavings: this.creditsSaved * 0.01, // Assuming $0.01/credit
};
}
}
export const costAwareCache = new CostAwareCache();
2. 重複排除
// src/lib/apollo/deduplication.ts
class DeduplicationService {
private seenEmails = new Set<string>();
private seenDomains = new Set<string>();
async enrichContactSafe(email: string): Promise<any> {
// Check if already enriched
if (this.seenEmails.has(email)) {
return costAwareCache.getContact(email);
}
// Check cache first
const cached = costAwareCache.getContact(email);
if (cached) {
return cached.data;
}
// Fetch and cache
const result = await apollo.enrichPerson({ email });
costAwareCache.setContact(email, result, 1);
this.seenEmails.add(email);
return result;
}
async enrichOrgSafe(domain: string): Promise<any> {
const normalizedDomain = domain.toLowerCase().replace(/^www\./, '');
if (this.seenDomains.has(normalizedDomain)) {
return costAwareCache.getContact(`org:${normalizedDomain}`);
}
const cached = costAwareCache.getContact(`org:${normalizedDomain}`);
if (cached) {
return cached.data;
}
const result = await apollo.enrichOrganization(normalizedDomain);
costAwareCache.setContact(`org:${normalizedDomain}`, result, 1);
this.seenDomains.add(normalizedDomain);
return result;
}
}
export const dedup = new DeduplicationService();
3. スマート検索戦略
// src/lib/apollo/cost-efficient-search.ts
/**
* Cost-efficient search: Start broad, then narrow
* Uses fewer credits by doing initial filtering before enrichment
*/
export async function costEfficientLeadSearch(criteria: LeadCriteria): Promise<Lead[]> {
// Step 1: Search without enrichment (cheaper)
const searchResults = await apollo.searchPeople({
q_organization_domains: criteria.domains,
person_titles: criteria.titles,
per_page: 100,
// Don't request emails yet - just basic info
});
// Step 2: Score and filter locally
const scoredLeads = searchResults.people
.map(person => ({
...person,
score: calculateLeadScore(person, criteria),
}))
.filter(lead => lead.score >= criteria.minScore)
.sort((a, b) => b.score - a.score)
.slice(0, criteria.maxEnrichments || 25);
// Step 3: Only enrich high-quality leads
const enrichedLeads = await Promise.all(
scoredLeads.map(async lead => {
if (!lead.email) {
// Only spend credit on email reveal if needed
const enriched = await dedup.enrichContactSafe(lead.id);
return { ...lead, ...enriched };
}
return lead;
})
);
return enrichedLeads;
}
function calculateLeadScore(person: any, criteria: LeadCriteria): number {
let score = 0;
// Title match
if (criteria.titles?.some(t =>
person.title?.toLowerCase().includes(t.toLowerCase())
)) {
score += 30;
}
// Seniority
if (['vp', 'director', 'c-level'].includes(person.seniority)) {
score += 25;
}
// Has LinkedIn
if (person.linkedin_url) {
score += 15;
}
// Company size fit
const employees = person.organization?.estimated_num_employees || 0;
if (employees >= criteria.minEmployees && employees <= criteria.maxEmployees) {
score += 20;
}
// Already has email (no enrichment needed)
if (person.email) {
score += 10;
}
return score;
}
4. 使用状況監視
// src/lib/apollo/usage-tracker.ts
interface UsageRecord {
timestamp: Date;
operation: string;
credits: number;
endpoint: string;
}
class UsageTracker {
private records: UsageRecord[] = [];
private monthlyBudget: number;
private alertThreshold: number;
constructor(monthlyBudget: number = 10000, alertThreshold: number = 0.8) {
this.monthlyBudget = monthlyBudget;
this.alertThreshold = alertThreshold;
}
track(operation: string, credits: number, endpoint: string): void {
this.records.push({
timestamp: new Date(),
operation,
credits,
endpoint,
});
this.checkBudget();
}
private checkBudget(): void {
const monthlyUsage = this.getMonthlyUsage();
const usagePercent = monthlyUsage / this.monthlyBudget;
if (usagePercent >= this.alertThreshold) {
console.warn(`Apollo usage alert: ${(usagePercent * 100).toFixed(1)}% of monthly budget used`);
// Could trigger webhook, Slack notification, etc.
}
if (usagePercent >= 1) {
console.error('Apollo monthly budget exceeded!');
}
}
getMonthlyUsage(): number {
const startOfMonth = new Date();
startOfMonth.setDate(1);
startOfMonth.setHours(0, 0, 0, 0);
return this.records
.filter(r => r.timestamp >= startOfMonth)
.reduce((sum, r) => sum + r.credits, 0);
}
getUsageReport(): UsageReport {
const monthly = this.getMonthlyUsage();
const byEndpoint = this.records.reduce((acc, r) => {
acc[r.endpoint] = (acc[r.endpoint] || 0) + r.credits;
return acc;
}, {} as Record<string, number>);
return {
monthlyUsage: monthly,
monthlyBudget: this.monthlyBudget,
usagePercent: (monthly / this.monthlyBudget) * 100,
byEndpoint,
projectedMonthlyUsage: this.projectMonthlyUsage(),
cacheSavings: costAwareCache.getStats().creditsSaved,
};
}
private projectMonthlyUsage(): number {
const now = new Date();
const dayOfMonth = now.getDate();
const daysInMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
const currentUsage = this.getMonthlyUsage();
return (currentUsage / dayOfMonth) * daysInMonth;
}
}
export const usageTracker = new UsageTracker(
parseInt(process.env.APOLLO_MONTHLY_BUDGET || '10000'),
parseFloat(process.env.APOLLO_ALERT_THRESHOLD || '0.8')
);
5. 予算対応クライアント
// src/lib/apollo/budget-client.ts
export class BudgetAwareApolloClient {
private dailyLimit: number;
private todayUsage = 0;
private lastResetDate: string = '';
constructor(dailyLimit: number = 500) {
this.dailyLimit = dailyLimit;
}
private checkDailyLimit(): void {
const today = new Date().toISOString().split('T')[0];
if (today !== this.lastResetDate) {
this.todayUsage = 0;
this.lastResetDate = today;
}
if (this.todayUsage >= this.dailyLimit) {
throw new Error('Daily Apollo credit limit reached. Try again tomorrow.');
}
}
async searchPeople(params: any): Promise<any> {
this.checkDailyLimit();
const result = await apollo.searchPeople(params);
const creditsUsed = result.people.length;
this.todayUsage += creditsUsed;
usageTracker.track('search', creditsUsed, 'people/search');
return result;
}
async enrichPerson(params: any): Promise<any> {
this.checkDailyLimit();
// Check cache first
const cacheKey = params.email || params.linkedin_url || params.id;
const cached = costAwareCache.getContact(cacheKey);
if (cached) {
return cached.data;
}
const result = await apollo.enrichPerson(params);
this.todayUsage += 1;
usageTracker.track('enrich', 1, 'people/enrich');
costAwareCache.setContact(cacheKey, result, 1);
return result;
}
getRemainingCredits(): number {
return this.dailyLimit - this.todayUsage;
}
}
export const budgetClient = new BudgetAwareApolloClient();
コスト最適化チェックリスト
- コンタクトデータの 7 日間キャッシュ
- メールとドメインの重複排除
- エンリッチメント前のリードスコアリング
- 日次/月次使用制限
- 80% 閾値での使用状況アラート
- モニタリングダッシュボードのコスト指標
- 定期的な使用状況レポートレビュー
- チームレベルの予算配分
出力
- コスト対応キャッシング戦略
- 重複排除サービス
- スマート検索スコアリング
- 使用状況追跡とアラート
- 予算対応 API クライアント
エラーハンドリング
| 問題 | 解決方法 |
|---|---|
| 予算超過 | オペレーション停止、チームへ通知 |
| 高いキャッシュ不中 | TTL を延長、パターンを確認 |
| 重複エンリッチメント | 重複排除ロジックを監査 |
| 予期しないコスト | 使用状況レポートを確認 |
リソース
次のステップ
アーキテクチャパターンについては apollo-reference-architecture に進んでください。
ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- Brmbobo
- リポジトリ
- Brmbobo/Web2podcast
- ライセンス
- MIT
- 最終更新
- 2026/1/26
Source: https://github.com/Brmbobo/Web2podcast / ライセンス: MIT
関連スキル
3-statement-model
3種類の財務諸表テンプレート(損益計算書、貸借対照表、キャッシュフロー計算書)を作成・記入・完成させることができます。モデルテンプレートの記入、既存のモデル枠組みの完成、財務モデルへのデータ入力、部分的に完成した損益/貸借/キャッシュフロー枠組みの完成、または既存テンプレート構造内での統合財務諸表の連携に対応しています。3種類の財務モデルテンプレートの記入、完成、またはデータ入力に関するご依頼で自動的に機能します。
strategic-decision
CEO・経営層向けの戦略的意思決定支援です。前提条件に異議を唱え、問題を診断し、確実な戦略を設計できます。4つのモード(AGGRESSIVE:大きな夢を見る、SELECTIVE:基盤を維持しつつ有望な拡張を厳選、DIAGNOSTIC:最大限の厳密性、VALIDATION:本質に絞る)を備えています。創業者、経営幹部、プロダクトリーダーが製品開発、成長戦略、市場戦略、技術選定、リソース配分に関する戦略的判断が必要な場面で活用できます。
value-realization
エンドユーザーが製品アイデアから明確な価値を感じるかどうかを分析します。以下の場面で活用できます:製品コンセプトの議論、機能の評価、製品改善の方向性提示、マーケティング戦略の企画、導入・継続率の問題分析、コピーが価値を伝えているかの検証、機能と利用シーンの対応付け、または製品方向性・ポジショニング・エンドユーザーの需要の有無が不確かな場合(例:「これは良いアイデアか」「この製品をどう思うか」「ユーザーは必要とするか」「この機能は何に役立つのか」「機能の価値をどう説明するか」「このコピーをどう思うか」「利用シーンを作成する手助けが欲しい」「ユーザーが継続利用しない理由は何か」「どうポジショニングすべきか」)。
creating-financial-models
このスキルは、投資判断に必要な高度な財務モデリング機能を提供します。DCF分析、感度分析、モンテカルロシミュレーション、シナリオプランニングなど、複数の分析手法を組み合わせることで、より正確で信頼性の高い財務予測が可能になります。
pestel-analysis
政治的、経済的、社会的、技術的、環境的、法的な外部要因を分析します。市場環境の変化が製品、ロードマップ、または戦略に大きな影響を与える可能性がある場合に活用できます。
chemical_safety_assessment
化学安全性評価 - 化学物質の安全性を評価します。PubChemの化合物情報、FDAの医薬品データ、ADMET予測、ChEMBLの構造警告を活用します。このスキルを使用することで、化合物名から一般情報を取得したり、医薬品名から警告および注意事項を取得したり、分子のADMETを予測したり、化合物の構造警告を検出したりできます。4つのSCPサーバーから4つのツールを統合しています。