Skip to main content
AuthForge uses a credit-based billing model. Understanding how credits are consumed helps you estimate costs and avoid running out.

Credit consumption

OperationCost
Successful license validation (POST /auth/validate)1 credit
Every 100 successful heartbeats1 credit
Failed validations (invalid key, expired, revoked) do not consume credits. Only successful authentications are billed.

Estimating monthly usage

Formula

monthly_credits = validate_credits + heartbeat_credits

validate_credits  = active_licenses × avg_logins_per_day × 30
heartbeat_credits = active_licenses × avg_hours_per_day × (60 / heartbeat_interval_min) × 30 / 100

Example calculation

Suppose you have:
  • 500 active licenses
  • Users log in once per day on average
  • Users run the app 8 hours per day
  • Heartbeat interval: 15 minutes (default)
validate_credits    = 500 × 1 × 30              = 15,000
heartbeat_credits   = 500 × 8 × 4 × 30 / 100   = 4,800
                                           Total = 19,800 credits/month
The 30k tier ($15/month) covers this with headroom.

Quick reference

Active licensesUsage patternEstimated monthly creditsRecommended tier
504 hrs/day, daily login~2,70010k ($10)
2008 hrs/day, daily login~12,48030k ($15)
5008 hrs/day, daily login~19,80030k ($15)
1,0008 hrs/day, daily login~39,600100k ($30)
5,0008 hrs/day, daily login~198,000500k ($100)

Credit tiers

TierCreditsPricePer 1k credits
10k10,000$10$1.00
30k30,000$15$0.50
100k100,000$30$0.30
500k500,000$100$0.20
1M1,000,000$150$0.15
Higher tiers offer better per-credit pricing. Choose the tier that covers your monthly estimate with a comfortable margin.

Auto-refill

Set up auto-refill to automatically purchase credits when your balance drops below a threshold. This prevents your users from experiencing no_credits failures.

Setup

  1. Go to the DashboardSettings → Billing
  2. Add a payment method (credit card via Stripe)
  3. Enable Auto-refill
  4. Configure:
    • Tier — Which credit package to purchase (10k, 30k, 100k, etc.)
    • Threshold — Trigger a purchase when balance falls below this number
    • Cooldown — Minimum time between auto-refill purchases (30 minutes to 24 hours)

Recommendations

Monthly usageThresholdTierCooldown
< 10k2,00010k24 hours
10k–30k5,00030k12 hours
30k–100k10,000100k6 hours
100k+20,000100k or 500k2 hours
Set the threshold high enough to cover your usage during the cooldown period. If you consume 1,000 credits per hour and your cooldown is 6 hours, set the threshold to at least 6,000.

Low balance alerts

Configure email alerts when your balance drops below a threshold:
  1. Go to Settings → Billing → Alerts
  2. Enable Low balance email
  3. Set your alert threshold
You’ll receive an email when your balance falls below the threshold, giving you time to purchase more credits or adjust auto-refill settings.

Optimizing credit usage

Use LOCAL heartbeat mode

If you don’t need instant revocation enforcement, switch to LOCAL heartbeat mode. This eliminates heartbeat credit consumption almost entirely — the SDK only makes a network call when the prepaid session block expires (~25 hours).
client = AuthForgeClient(
    app_id="...",
    app_secret="...",
    heartbeat_mode="LOCAL",  # Minimal credit usage
)
Credit savings: For a user running the app 8 hours/day, SERVER mode consumes ~32 heartbeats/day (1 every 15 min). LOCAL mode consumes ~0.3 validate calls/day (1 re-validate per ~25 hours). That’s roughly 100x fewer credits.

Increase heartbeat interval

If you want SERVER mode but don’t need 15-minute checks, increase the interval:
client = AuthForgeClient(
    app_id="...",
    app_secret="...",
    heartbeat_mode="SERVER",
    heartbeat_interval=1800,  # 30 minutes instead of 15
)
Doubling the interval halves your heartbeat credit consumption.

Avoid redundant logins

If your app can open multiple windows or instances, authenticate once and share the session:
# Don't authenticate in every window/instance
# Use a lockfile or IPC to coordinate
if is_primary_instance():
    client.login(license_key)
else:
    wait_for_primary_auth()
See SDK Best Practices: Multi-instance for implementation details.

Monitoring usage

Check your current balance and transaction history in the dashboard:
  • Settings → Billing shows your current balance
  • Transaction history shows credits purchased, consumed, and auto-refilled
  • Usage stats show authentication volume per app

What happens when credits run out

When your account has zero credits:
  1. SDK validate calls receive a no_credits error. The SDK treats this as a login failure.
  2. Heartbeat milestones (every 100th heartbeat) fail with no_credits. The SDK triggers the failure callback.
Users already authenticated continue running until their next heartbeat milestone or session expiry. They aren’t immediately disconnected.
Your users see “Authentication service temporarily unavailable” — they don’t know it’s a billing issue on your end. Set up auto-refill to prevent this.