docsUsage Quotas

Usage Quotas

Understanding Quotas

Quotas help you monitor and control your AI usage costs by setting spending limits.

Configuring Quotas

Method 1: Configuration File

Edit ~/.config/ocmonitor/config.toml to set quota limits:

[quotas]
# Daily spending limits per model (in USD)
daily_limits = {
    claude-sonnet-4 = 10.0,
    claude-opus-4 = 20.0,
    claude-opus-4.1 = 25.0
}
 
# Weekly spending limits
weekly_limits = {
    claude-sonnet-4 = 50.0,
    claude-opus-4 = 100.0
}
 
# Monthly spending limits
monthly_limits = {
    claude-sonnet-4 = 200.0,
    claude-opus-4 = 400.0,
    "*" = 500.0  # Total limit across all models
}
 
# Enable quota warnings
enable_warnings = true
 
# Warning threshold (percentage of quota)
warning_threshold = 80.0
 
# Action when quota exceeded: "warn", "block"
quota_action = "warn"

Method 2: Environment Variables

Set quotas using environment variables:

# Daily limits
export OCMONITOR_DAILY_CLAUDE_SONNET_4=10.0
export OCMONITOR_DAILY_CLAUDE_OPUS_4=20.0
 
# Monthly limits
export OCMONITOR_MONTHLY_TOTAL=500.0

Quota Examples

Basic Daily Limits

[quotas]
daily_limits = {
    claude-sonnet-4 = 15.0,  # $15/day for Sonnet
    claude-opus-4 = 30.0     # $30/day for Opus
}
enable_warnings = true

Comprehensive Quota Setup

[quotas]
# Daily limits per model
daily_limits = {
    claude-sonnet-4 = 10.0,
    claude-opus-4 = 20.0,
    "*" = 35.0  # Total daily limit
}
 
# Weekly limits
weekly_limits = {
    claude-sonnet-4 = 60.0,
    claude-opus-4 = 120.0,
    "*" = 200.0
}
 
# Monthly limits
monthly_limits = {
    claude-sonnet-4 = 250.0,
    claude-opus-4 = 500.0,
    "*" = 800.0
}
 
# Warning settings
enable_warnings = true
warning_threshold = 75.0  # Warn at 75% of quota
email_notifications = "admin@example.com"

Viewing Quota Status

Check your current quota usage:

# Show quota status in daily report
ocmonitor daily ~/.local/share/opencode/storage/message --show-quotas
 
# Show quota status in model breakdown
ocmonitor models ~/.local/share/opencode/storage/message --show-quotas