Overview
The quota protection system prevents complete account exhaustion by:- Real-time quota monitoring - Tracks remaining quota per model
- Model-level protection - Locks specific models when quota is low
- Automatic recovery - Re-enables models when quota replenishes
- Account rotation - Seamlessly switches to healthy accounts
How Quota Protection Works
1. Quota Monitoring
During account loading, the system checks quota levels for each model:2. Model Grouping & Aggregation
The system groups model variants by standard ID to prevent conflicts:gemini-3.1-pro-lowat 0% andgemini-3.1-pro-highat 100% causing routing conflicts
3. Protection Triggering
When quota falls below the threshold, the model is added to the protected list:4. Runtime Filtering
During token selection, protected models are automatically skipped:5. Automatic Recovery
When quota replenishes above the threshold, models are automatically restored:In-Memory Quota Cache
To avoid disk I/O during routing, quota data is cached in memory:- Zero disk latency during hot path routing
- Accurate quota-based sorting
- Real-time protection status
Migration from Account-Level to Model-Level Protection
Antigravity v4.1.27 migrated from account-level to model-level protection:- Accounts with mixed quota levels remain partially available
- Only exhausted models are protected
- Better resource utilization
Configuration
Enable Quota Protection
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable/disable quota protection |
threshold_percentage | integer | 10 | Minimum quota % before protection triggers |
monitored_models | array | [] | List of model IDs to monitor |
Best Practices
- Set threshold at 10-15% - Provides buffer before complete exhaustion
- Monitor high-value models - Focus on expensive models like Opus
- Keep auto-refresh enabled - Ensures protection reacts to quota changes
- Review protected models daily - Identify accounts needing attention
- Use multiple accounts - Distribute load to prevent single-point exhaustion
Monitoring Protected Models
Check protection status via the account detail view:Troubleshooting
Issue: Account still used after protection enabled
Cause: Protection requires account reload to take effect. Solution:Issue: Model shows protected but has quota
Cause: Variant grouping - one variant may have low quota while another has high. Solution: Check all variants (e.g.,pro-low vs pro-high) in account details.
Issue: All accounts protected, service down
Cause: All accounts exhausted below threshold. Solution:- Add more accounts
- Lower threshold temporarily
- Wait for quota reset
Related
- Smart Routing - How accounts are selected
- Self-Healing - Automatic retry mechanisms
- Account Management - Adding and managing accounts