Skip to content

Feature Request: Add method to get access request counts for analytics/monitoring #3596

@balanprasanth

Description

@balanprasanth

Feature Description

Add API methods to retrieve access request counts (accepted/pending/rejected) without full iteration, optimized for analytics and monitoring use cases.

Context

As discussed in #3591, there's currently no way to get access counts without iterating through all users. For large gated models, this approach is inefficient for common monitoring workflows.

Motivation & Use Cases

Primary Use Cases:

  1. 📊 Analytics Dashboards: Display current user counts across multiple models
  2. 📈 Growth Tracking: Monitor daily/weekly user acquisition trends

Example Scenario:

# Current approach - takes 5-10 minutes 
for model in my_10_gated_models:
    count = sum(1 for _ in api.list_accepted_access_requests(model, "model"))
    dashboard.update(model, count)
# Total time: 50-100 minutes for 10 models

Proposed API

Option 1: Stats method with accuracy tradeoff

stats = api.get_access_request_stats(
    repo_id="google/gemma-2-2b-it",
    repo_type="model",
    approximate=True  # Allow slightly stale counts for performance
)
# Returns: {
#     "accepted": 595174,
#     "pending": 1234,
#     "rejected": 567,
#     "total": 596975,
#     "last_updated": "2024-12-05T10:30:00Z"  # Cache timestamp
# }

Priority

I understand this may not be short-term priority. it would be valuable for the ecosystem. Many organizations building on HF Hub would benefit from this.

Thanks for considering! 🙏


Related: #3591 (where this need was identified)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions