Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/rotator_library/providers/chutes_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import httpx
import os
from typing import Any, Dict, List, Optional, TYPE_CHECKING
from .provider_interface import ProviderInterface
from .provider_interface import ProviderInterface, UsageResetConfigDef
from .utilities.chutes_quota_tracker import ChutesQuotaTracker

if TYPE_CHECKING:
Expand All @@ -22,6 +22,25 @@ class ChutesProvider(ChutesQuotaTracker, ProviderInterface):
Provider implementation for the chutes.ai API with quota tracking.
"""

# Enable environment variable overrides (e.g., QUOTA_GROUPS_CHUTES_GLOBAL)
provider_env_name = "chutes"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix confirmed: Added provider_env_name as suggested to enable environment variable overrides for quota groups.


# Quota groups for tracking daily limits
# Uses a virtual model "_quota" for credential-level quota tracking
model_quota_groups = {
"chutes_global": ["_quota"],
}

# Usage reset configuration for daily quota
usage_reset_configs = {
"default": UsageResetConfigDef(
window_seconds=86400, # 24 hours (daily quota reset)
mode="per_model",
description="Chutes daily quota",
field_name="daily",
)
}
Comment on lines +35 to +42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix confirmed: Switched to usage_reset_configs class attribute and removed the redundant get_usage_reset_config override. This keeps the implementation declarative and consistent with the ProviderInterface patterns.


def __init__(self, *args, **kwargs):
"""Initialize ChutesProvider with quota tracking."""
super().__init__(*args, **kwargs)
Expand Down