/klaviyo-pack:klaviyo-cost-tuningfrom klaviyo-pack
Optimize Klaviyo costs by auditing active profiles, identifying unengaged contacts, and managing plan selection. Useful when analyzing Klaviyo billing or reducing monthly spend.
Ships in klaviyo-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.
Optimize Klaviyo costs through active profile management, list hygiene, event sampling, and API usage monitoring. Klaviyo bills primarily by active profiles and message volume, not API calls.
klaviyo-api SDK for programmatic managementKlaviyo bills based on active profiles (contacts who have received or been targeted by marketing), not API requests.
| Component | How It's Billed | Cost Driver |
|---|---|---|
| Per active profile tier | Number of marketable profiles | |
| SMS | Per message sent + carrier fees | Message volume |
| Push | Included with email plan | N/A |
| API calls | Free (rate limited, not billed) | N/A |
| Reviews | Per request volume | Review request sends |
| Active Profiles | Monthly Cost |
|---|---|
| 0 - 250 | Free |
| 251 - 500 | $20/mo |
| 501 - 1,000 | $30/mo |
| 1,001 - 1,500 | $45/mo |
| 1,501 - 5,000 | $60-$100/mo |
| 5,001 - 10,000 | $100-$150/mo |
| 10,001 - 25,000 | $150-$375/mo |
| 25,001+ | Custom pricing |
Key insight: Reducing active profiles has the biggest cost impact. Cleaning suppressed/unengaged contacts directly reduces your bill.
import { ApiKeySession, ProfilesApi, SegmentsApi } from 'klaviyo-api';
const session = new ApiKeySession(process.env.KLAVIYO_PRIVATE_KEY!);
const profilesApi = new ProfilesApi(session);
// Count total profiles
let totalProfiles = 0;
let cursor: string | undefined;
do {
const response = await profilesApi.getProfiles({
pageCursor: cursor,
fieldsProfile: ['email'], // Minimal fields for speed
});
totalProfiles += response.body.data.length;
const nextLink = response.body.links?.next;
cursor = nextLink ? new URL(nextLink).searchParams.get('page[cursor]') || undefined : undefined;
} while (cursor);
console.log(`Total profiles: ${totalProfiles}`);
// Find profiles that haven't opened/clicked in 180+ days
// Create a segment in Klaviyo for this, then query it
const segmentsApi = new SegmentsApi(session);
const segments = await segmentsApi.getSegments({
filter: 'equals(name,"Unengaged 180+ Days")',
});
if (segments.body.data.length > 0) {
const segmentId = segments.body.data[0].id;
const unengaged = await segmentsApi.getSegmentProfiles({
id: segmentId,
fieldsProfile: ['email', 'created'],
});
console.log(`Unengaged profiles: ${unengaged.body.data.length}+`);
}
// Move unengaged profiles to a suppressed list (removes from active count)
import { ListsApi, ListEnum, ProfileEnum } from 'klaviyo-api';
const listsApi = new ListsApi(session);
// Option 1: Unsubscribe (profile stays but isn't marketable = not billed)
await profilesApi.unsubscribeProfiles({
data: {
type: 'profile-subscription-bulk-delete-job',
attributes: {
profiles: {
data: unengagedEmails.map(email => ({
type: ProfileEnum.Profile,
attributes: {
email,
subscriptions: {
email: { marketing: { consent: 'UNSUBSCRIBED' } },
},
},
})),
},
},
relationships: {
list: { data: { type: ListEnum.List, id: 'MAIN_LIST_ID' } },
},
},
});
// Option 2: Suppress via profile update (add to global suppression)
for (const email of unengagedEmails) {
await profilesApi.createOrUpdateProfile({
data: {
type: ProfileEnum.Profile,
attributes: {
email,
properties: { suppressedAt: new Date().toISOString(), suppressReason: 'unengaged-180d' },
},
},
});
}
// Not all events need to be tracked -- sample non-critical ones
function shouldTrackEvent(eventName: string, samplingRates: Record<string, number>): boolean {
const rate = samplingRates[eventName] ?? 1.0; // Default: track everything
return Math.random() < rate;
}
const samplingConfig = {
'Placed Order': 1.0, // Always track (revenue attribution)
'Started Checkout': 1.0, // Always track (cart abandonment)
'Viewed Product': 0.25, // 25% sample (high volume, less critical)
'Page View': 0.1, // 10% sample (very high volume)
};
// Before tracking
if (shouldTrackEvent('Viewed Product', samplingConfig)) {
await eventsApi.createEvent({ /* ... */ });
}
// Track API call volume to detect runaway processes
class KlaviyoUsageTracker {
private callCount = 0;
private readonly startTime = Date.now();
track(): void {
this.callCount++;
// Warn if approaching steady rate limit
const elapsedMinutes = (Date.now() - this.startTime) / 60000;
const ratePerMinute = this.callCount / Math.max(elapsedMinutes, 1);
if (ratePerMinute > 500) {
console.warn(`[Klaviyo] High API rate: ${Math.round(ratePerMinute)} req/min (limit: 700)`);
}
}
getStats(): { totalCalls: number; ratePerMinute: number } {
const elapsedMinutes = (Date.now() - this.startTime) / 60000;
return {
totalCalls: this.callCount,
ratePerMinute: Math.round(this.callCount / Math.max(elapsedMinutes, 1)),
};
}
}
export const usageTracker = new KlaviyoUsageTracker();
| Issue | Cause | Solution |
|---|---|---|
| Unexpected bill increase | Unengaged profiles grew | Run suppression script |
| SMS costs spiking | Flow sending to full list | Add engaged-only segment filter |
| Duplicate profiles | Multiple identify calls | Merge duplicates, use createOrUpdateProfile |
| API rate limits hit | Bulk operations | Use queue with concurrency control |
For architecture patterns, see klaviyo-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
24 skills in this plugin
/klaviyo-ci-integrationConfigure CI/CD pipelines for Klaviyo integrations with GitHub Actions.
Use when setting up automated testing, configuring CI secrets,
or integrating Klaviyo SDK tests into your build pipeline.
Trigger with phrases like "klaviyo CI", "klaviyo GitHub Actions",
"klaviyo automated tests", "CI klaviyo", "klaviyo pipeline".
/klaviyo-common-errorsDiagnose and fix common Klaviyo API errors and exceptions.
Use when encountering Klaviyo 4xx/5xx errors, debugging failed requests,
or troubleshooting SDK integration issues.
Trigger with phrases like "klaviyo error", "fix klaviyo",
"klaviyo not working", "debug klaviyo", "klaviyo 400", "klaviyo 429".
/klaviyo-core-workflow-aExecute Klaviyo primary workflow: profiles, lists, and subscriptions.
Use when creating/updating profiles, managing lists, subscribing contacts,
or syncing customer data to Klaviyo for email/SMS marketing.
Trigger with phrases like "klaviyo profiles", "klaviyo lists",
"klaviyo subscribe", "add contacts to klaviyo", "klaviyo customer data".
/klaviyo-core-workflow-bExecute Klaviyo secondary workflow: event tracking, segments, and campaigns.
Use when tracking customer events, creating segments, building campaigns,
or triggering flows via the Klaviyo API.
Trigger with phrases like "klaviyo events", "klaviyo segments",
"klaviyo campaigns", "track klaviyo event", "klaviyo flow trigger".
/klaviyo-data-handlingImplement Klaviyo data privacy, GDPR/CCPA compliance, and PII handling patterns.
Use when handling profile data, implementing right-to-deletion, configuring
data retention, or ensuring compliance with privacy regulations.
Trigger with phrases like "klaviyo data", "klaviyo PII",
"klaviyo GDPR", "klaviyo data retention", "klaviyo privacy", "klaviyo CCPA",
"klaviyo delete profile", "klaviyo data privacy".
/klaviyo-debug-bundleCollect Klaviyo debug evidence for support tickets and troubleshooting.
Use when encountering persistent issues, preparing support tickets,
or collecting diagnostic information for Klaviyo API problems.
Trigger with phrases like "klaviyo debug", "klaviyo support bundle",
"collect klaviyo logs", "klaviyo diagnostic", "klaviyo troubleshoot".
npx claudepluginhub flight505/skill-forge --plugin klaviyo-packOther plugins' skills for the same job