Skip to main content

Overview

Percify uses a unified credit model to keep pricing transparent and enable future tier overrides without rewriting feature logic. All generation actions debit credits atomically after success.

Feature Costs

FeatureBaseIncrementNotes
Image Standard (Flux)2Per output
Image Premium (Imagen3 / Reality4)5Per output
Percify Yourself10Photo → avatar
Avatar Cast30Multi-character scene
Voice Cloning5One-time profile creation
Audio Generation5+1/secDuration based
Video Studio30+6/sec >5s5s base window
Reality Lab20+4/sec >5sCinematic motion

Centralized Logic (credit-costs.ts)

Exports:
  • DEFAULT_COSTS – baseline values
  • TIER_COSTS – placeholder map for future tier overrides
  • getFeatureCost(feature) – simple lookup
  • calculateVideoCost(duration, feature) – base + perSecond dynamic
  • calculateAudioCost(duration) – base + perSecond

Example Usage

import { calculateVideoCost, getFeatureCost } from '@/lib/credit-costs';

const imageCost = getFeatureCost('imageStandard'); // 2
const videoCost = calculateVideoCost(12, 'videoStudio'); // 30 + 7*6 = 72

Debit Flow

  1. User initiates generation
  2. System validates sufficient balance
  3. Job runs (async or inline)
  4. On success → debit transaction committed
  5. On failure → no debit (idempotent)

UI Display

Use getAllCosts() to present current pricing table; dynamic adjustments possible once tier overrides implemented.

Future Tier Pricing (Planned)

TierOverride Strategy
freeDefaults
starterPotential volume discounts
creatorPremium model cost reduction
scaleLower per-second video increments
unlimitedCustom negotiated bundle

Rationale

GoalApproach
ConsistencySingle source of truth file
FlexibilityTier override map ready
TransparencyDeterministic cost formulas
MaintainabilityEliminates 19+ hardcoded scattered values

Troubleshooting

ProblemCauseResolution
Unexpected high debitLong durations or cast scenesCheck cost formula before confirming
Mismatch UI vs API costStale client cacheRefresh pricing via API or rebuild
Insufficient balance mid workflowMultiple queued jobsReserve credits (planned feature)
  • [/percify/payments]
  • [/percify/image-to-video]
  • [/percify/voice-cloning]

Continue to payment flows at [/percify/payments].