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
| Endpoint | Typical Cost | Notes |
|---|---|---|
/responses | 1–5 credits | Depends on tokens |
/mave/chat | 10–50 credits | Research complexity |
/personas (GET) | 0 | Free |
/focus-groups | 50–200 credits | Sample size + questions |
/video-analyses | 100–500 credits | Video length |
/personas (POST) | 300 credits | Custom persona creation |
/brand-voices (POST) | 50 credits | Brand voice creation |
Pattern 1: In-App Usage Tracking
Accumulatecredits_used from each response and persist it (e.g. Redis, DB) so you have real-time usage without polling the dashboard.
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.Go to Usage Settings
Navigate to app.mavera.io/settings/usage
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.Go to Billing
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 withbudget_exceeded.
| Setting | Description |
|---|---|
| Budget Alert | Notification when spending reaches threshold |
| Usage Limit | Hard cap; blocks requests when reached |
| Billing Email | Separate email for budget notifications |
Metrics to Monitor
| Metric | What to track |
|---|---|
credits_used_total | Sum of usage.credits_used from all responses |
credits_used_by_endpoint | Breakdown by endpoint (chat, mave, focus-groups, etc.) |
402_count | Number of credit exhaustion errors |
estimated_vs_actual | Compare pre-flight estimates to actual usage (for calibration) |
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