Custom Quota Strategy
The Custom Quota strategy provides granular control over API traffic, enabling limits based on tokens and requests within a fixed time window.
Supports configurations for:
- Maximum requests allowed
- Flexible time windows for rate limiting (e.g., minute, hour).
/etc/lunar-proxy/quotas/{fileName}.yaml
quotas:
- id: FixedWindowCustomCounter # Unique identifier for the quota
filter:
url: api.openai.com/* # URL pattern to apply the quota
strategy:
fixed_window_custom_counter:
max: 40000 # Maximum requests allowed within the window
interval: 1
interval_unit: minute # Time window duration in minutes
counter_value_path: | # JSONPath used to define where to collect token count
$.request.headers["x-lunar-used-tokens"]