Skip to content

Conversation

@b3nw
Copy link
Contributor

@b3nw b3nw commented Jan 20, 2026

Summary

Fixes the Chutes provider quota display in the TUI Quota Viewer. Previously, the quota status showed - even though the provider was tracking usage correctly.

Changes

  • Add model_quota_groups class attribute - Defines the chutes_global quota group mapping to the _quota virtual model, enabling client.py's get_quota_stats() to populate the quota_groups response
  • Add get_models_in_quota_group() - Returns the models belonging to a given quota group
  • Add get_quota_groups() - Exposes the available quota groups for the provider
  • Add get_usage_reset_config() - Enables per_model tracking mode required for proper quota baseline storage

Result

The TUI now correctly displays quota status for Chutes:

  • Shows usage like 297/300 with percentage bar
  • Displays reset time (UTC midnight daily reset)
  • Shows confidence indicator based on baseline freshness

Testing

  • Verified quota fetching from Chutes API works correctly
  • Confirmed TUI displays quota status with progress bar
  • Tested with live API calls to verify request counting

Important

Fixes TUI quota display for Chutes provider by adding methods for quota groups and usage reset configuration in chutes_provider.py.

  • Behavior:
    • Fixes quota display in TUI for Chutes provider, showing usage like 297/300 with a percentage bar.
    • Displays reset time (UTC midnight daily reset) and confidence indicator based on baseline freshness.
  • Functions:
    • Adds model_quota_groups attribute in ChutesProvider for chutes_global mapping to _quota.
    • Adds get_models_in_quota_group() to return models in a quota group.
    • Adds get_quota_groups() to expose available quota groups.
    • Adds get_usage_reset_config() for per_model tracking mode.
  • Testing:
    • Verified quota fetching from Chutes API and TUI display with live API calls.

This description was created by Ellipsis for f904477. You can customize this summary. It will automatically update as commits are pushed.

- Add model_quota_groups class attribute for client.py integration
- Add get_models_in_quota_group() to map quota groups to virtual models
- Add get_quota_groups() to expose available quota groups
- Add get_usage_reset_config() to enable per_model tracking mode

These changes enable the TUI quota viewer to correctly display
the Chutes provider's daily quota (e.g., 297/300, 99% remaining).
@b3nw b3nw requested a review from Mirrowel as a code owner January 20, 2026 06:20
Repository owner deleted a comment from mirrobot-agent bot Jan 20, 2026
@mirrobot-agent
Copy link
Contributor

I'm starting my review of the Chutes provider quota system. Looking into the new methods in chutes_provider.py to ensure they correctly integrate with the TUI quota viewer.

Copy link
Contributor

@mirrobot-agent mirrobot-agent bot left a comment

Choose a reason for hiding this comment

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

Overall Assessment

This PR correctly implements the necessary hooks to enable quota display for the Chutes provider in the TUI. The addition of the model_quota_groups attribute and the background job logic for updating the quota baseline are solid and follow the intended design for credential-level quota tracking via a virtual _quota model.

The main suggestions below are focused on aligning the implementation more closely with the established patterns in the ProviderInterface. By using class attributes instead of direct method overrides where possible, we maintain consistency across providers and preserve built-in functionality like environment variable overrides.

Architectural Feedback

The approach of using a virtual _quota model to track the global credential-level quota is excellent. It allows the generic TUI logic to display usage stats without needing to know provider-specific details about how credits are consumed across different models.

Key Suggestions

  • Consistency with ProviderInterface: Use usage_reset_configs class attribute instead of overriding get_usage_reset_config directly.
  • Remove Redundant Overrides: get_models_in_quota_group is already handled by the base class if model_quota_groups is defined.
  • Enable Env Overrides: Set provider_env_name to allow users to customize quota groups via environment variables.

Questions for the Author

None. The implementation logic for the background job and quota fetching looks robust.

This review was generated by an AI assistant.

- Add provider_env_name for env var overrides support
- Replace get_usage_reset_config() with usage_reset_configs class attribute
- Remove redundant get_models_in_quota_group() (uses base class implementation)
- Remove unused get_quota_groups() method

Addresses review feedback from mirrobot-agent.
@b3nw
Copy link
Contributor Author

b3nw commented Jan 21, 2026

All issues resolved.

@Tarquinen
Copy link

@mirrobot-agent review it again, all issues resolved

@b3nw
Copy link
Contributor Author

b3nw commented Jan 21, 2026

@mirrobot-agent re-review

@mirrobot-agent
Copy link
Contributor

@b3nw, I'm on it! I'll take another look at the changes and see how the Chutes provider quota system is shaping up. Back in a moment with the results. 🔍

Copy link
Contributor

@mirrobot-agent mirrobot-agent bot left a comment

Choose a reason for hiding this comment

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

Overall Assessment

Excellent work. The Chutes provider implementation now fully aligns with the ProviderInterface patterns while maintaining the robust background job logic for quota tracking.

The move to declarative class attributes for quota groups and usage reset configurations is much cleaner and ensures that built-in functionality (like environment variable overrides) works as expected. The virtual _quota model approach remains a highlight of this PR, providing a elegant way to handle credential-level limits.

Architectural Feedback

None. The implementation is now idiomatic and consistent with the rest of the codebase.

Key Changes Verified

  • Declarative Config: Replaced method overrides with usage_reset_configs and model_quota_groups attributes.
  • Env Variable Support: Enabled via provider_env_name = "chutes".
  • Code Cleanup: Removed redundant overrides for get_models_in_quota_group and get_quota_groups.

This review was generated by an AI assistant.

"""

# 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.

Comment on lines +35 to +42
usage_reset_configs = {
"default": UsageResetConfigDef(
window_seconds=86400, # 24 hours (daily quota reset)
mode="per_model",
description="Chutes daily quota",
field_name="daily",
)
}
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.

@mirrobot-agent
Copy link
Contributor

@b3nw, I've completed the re-review.

Summary

The changes look great! You've successfully addressed all the points from the previous review.

Key Changes Verified

  • Declarative Configuration: Switched to using usage_reset_configs and model_quota_groups class attributes, which is much cleaner and keeps the provider idiomatic.
  • Environment Variable Support: Added provider_env_name = "chutes", enabling users to override quota groups via environment variables (e.g., QUOTA_GROUPS_CHUTES_GLOBAL).
  • Simplified Implementation: Removed the redundant method overrides for get_models_in_quota_group, get_quota_groups, and get_usage_reset_config.

The implementation is solid and ready to go. Great work!

This summary was generated by an AI assistant.

@b3nw
Copy link
Contributor Author

b3nw commented Jan 21, 2026

@mirrobot-agent everything looks great LGTM go go go!

@mirrobot-agent
Copy link
Contributor

@b3nw, Message received! "Go go go!" it is. I'm checking the PR status and CI results now. If everything is green, I'll proceed with the merge. 🚀

@mirrobot-agent
Copy link
Contributor

@b3nw, I tried to merge the PR, but it's currently blocked by repository rules. It's waiting on a required code owner review from Mirrowel.

Since I'm operating as mirrobot-agent, I can't bypass this specific requirement myself. You might need to ping @Mirrowel or another maintainer with the appropriate permissions to give the final nod!

In the meantime, I'll keep an eye on it. Let me know if there's anything else I can assist with! 🔍

@Mirrowel Mirrowel merged commit ea7b0a5 into Mirrowel:dev Jan 21, 2026
2 of 3 checks passed
b3nw pushed a commit to b3nw/LLM-API-Key-Proxy that referenced this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants