Skip to main content

When to Use This

You’re building a production integration and need to:
  • Track credits across requests in your application (not just rely on dashboard)
  • Estimate cost before making expensive calls (Mave, Focus Groups, Video Analysis)
  • Alert when usage approaches 50%, 75%, 90% of monthly allocation
  • Handle 402 gracefully — show users a clear message instead of a raw error
  • Pre-flight check to avoid starting expensive jobs when credits are insufficient

Credit Costs at a Glance


Pattern 1: In-App Usage Tracking

Accumulate credits_used from each response and persist it (e.g. Redis, DB) so you have real-time usage without polling the dashboard.
Use the dashboard (app.mavera.io/settings/usage) as source of truth. In-app tracking is for real-time estimates; reconcile periodically with the API or dashboard data if available.

Pattern 2: Estimate Cost Before Calling

Before starting an expensive operation (focus group, video analysis), estimate the cost and compare against a threshold or remaining credits.

Pattern 3: Pre-Flight Check (Block Expensive Jobs)

Before kicking off a focus group or video analysis, check estimated cost vs. remaining credits. Fail fast with a clear message instead of failing mid-run with 402.

Pattern 4: Dashboard Budget Alerts

Configure alerts in the Mavera dashboard so you’re notified before you run out. No code required — just settings.
1

Go to Usage Settings

2

Set Alert Thresholds

Enable alerts at 50%, 75%, and 90% of monthly credits
3

Add Notification Email

Ensure the billing/ops email receives alerts
4

Optional: Workspace Budgets

For team accounts, set per-workspace budgets at Workspace Settings > Budget

Pattern 5: Auto-Recharge (Dashboard)

When credits run low, auto-recharge can automatically purchase more so high-priority jobs don’t fail.
2

Enable Auto-Recharge

Toggle on “Auto-recharge credits”
3

Set Threshold

e.g. Trigger when credits fall below 100
4

Set Recharge Amount

e.g. Purchase 500 credits
Use auto-recharge as a safety net, not as primary capacity planning. Monitor usage trends and upgrade your plan or adjust thresholds as needed.

Pattern 6: Graceful Degradation on 402

When you get a 402, don’t show a generic “API error.” Return a clear message and optionally queue the request for retry after credits are added.

Pattern 7: Per-Workspace Budgets (Teams)

For team accounts, set workspace-level and project-level budgets. When a budget is exceeded, requests for that workspace/project return 402 with budget_exceeded. Configure at Workspace Settings > Budget.

Metrics to Monitor


See Also

Credits Guide

Allocation, costs by endpoint, auto-recharge

Error Handling Patterns

Handling 402 in your error flow

Billing & Usage

Dashboard usage and alerts

Pricing

Plans and credit packages