Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents the credit system's configuration, pricing, plan allocations, and purchase UI for adding credit types.
23% 100%+77 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 5 of 22 without it.
3 of 3 safety checks passed
29 agent runs
This skill guides you through the entire credit system, from backend configuration to frontend UI implementation.
All credit configuration lives in src/lib/credits/config.ts.
Define the Type: Add the new type to creditTypeSchema enum.
export const creditTypeSchema = z.enum([
"image_generation",
"video_generation",
"your_new_credit_type" // Add this
]);
Configure Pricing & Metadata: Add an entry to creditsConfig.
your_new_credit_type: {
name: "New Credit Name",
currency: "USD",
minimumAmount: 10,
// Option A: Fixed Slabs
slabs: [
{ from: 1, to: 100, pricePerUnit: 0.10 },
{ from: 101, to: 1000, pricePerUnit: 0.08 },
],
// Option B: Dynamic Calculator (e.g., based on user plan)
priceCalculator: (amount, userPlan) => {
// Logic here
return amount * 0.1;
}
}
Plan Allocations (Optional): Define how many credits are given when subscribing to a plan in onPlanChangeCredits.
Next to this one in the catalogue, plus more from the same author.