Skip to main content
GET

Authentication

Required: JWT Bearer token

Response

array
Array of model statistics objects

Side Effects

Database Reads (Line 88):
Tables Read:
  • ai_models table: Model metadata
  • model_votes table: Aggregated vote counts
  • Potential JOIN with comparisons table (service-level)
No Database Writes: Read-only endpoint Query Characteristics:
  • Aggregation query (COUNT, SUM operations assumed)
  • Potentially expensive for large vote datasets

Authorization

Authentication: Required (JWT Bearer) Who Can Read:
  • Any authenticated user
Data Visibility:
  • Global statistics (not user-specific)
  • All users see same data

Permissions

No User Filtering: Statistics global across all users No Privacy Controls: All model performance data public to authenticated users

Response Structure

Ordering: Not specified by API contract (implementation-defined)
  • Ordering algorithm not enforced by server contract
  • No explicit sort parameter in controller
Pagination: Not supported
  • Returns ALL models
  • Could cause performance issues if many models
Filtering: Not supported
  • No query parameters for filtering by provider, win_rate, etc.

Edge Cases

  1. No votes exist: Behavior not enforced by server contract (empty array likely)
  2. Model has zero votes: Inclusion behavior not enforced by server contract
  3. Models without votes: Inclusion behavior not enforced by server contract
  4. Inactive models: Inclusion behavior not enforced by server contract
  5. Very large result set: No pagination, performance not guaranteed

Error Conditions

Exception Handling (Lines 92-100):
  • All service exceptions return 500
  • Exception message exposed to client

Behavioral Guarantees

Data Staleness: Not specified by API contract
  • Cache behavior implementation-defined and not guaranteed
  • Real-time vs. cached not enforced by server contract
Consistency: Not guaranteed
  • Votes in progress may not be reflected
  • Consistency model not enforced by server contract
Completeness: Not specified by API contract

Calculation Methods

Win Rate (service-level):
  • Calculation formula not enforced by server contract
  • Behavior when total_votes = 0 not specified by API contract
Elo Rating (service-level):
  • Calculation algorithm not documented in controller
  • Null handling not enforced by server contract
Ties/Losses Counting (service-level):
  • Vote counting logic not enforced by server contract
  • Increment semantics implementation-defined and not guaranteed

Performance Characteristics

Query Complexity: Depends on service implementation
  • Simple aggregation: Fast
  • Complex Elo calculation: Slower
Index Requirements:
  • model_votes.model_id should be indexed
  • model_votes.created_at for last_voted_at
Response Size: Unbounded (proportional to number of models) Caching: Not enforced by server contract
  • Cache behavior implementation-defined and not guaranteed
  • Cache invalidation strategy not specified by API contract

Use Cases

Leaderboard Display:
  • Sort by win_rate or elo_rating
  • Display top N models
Model Selection:
  • Used by GetTopperAndRandomModelAsync for dual-chat topper mode
  • Selects highest-rated model
Analytics:
  • Track model performance over time
  • Compare provider effectiveness

Data Freshness

Update Trigger: Vote submission endpoint
  • Stats updated when vote recorded
  • Update timing not enforced by server contract (immediate vs. batch)
Stale Data Risk: Data freshness not enforced by server contract Real-Time Guarantee: Not specified by API contract