-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Problem
The API rejects usage data for newer Claude models that aren't in the server's whitelist.
Current error:
{"error":{"message":"Usage validation failed: Invalid or unknown model: claude-opus-4-5-20251101"}}This is the same issue as #15 (claude-sonnet-4-5-20250929), but for Opus 4.5.
Root Cause
The backend appears to maintain a hardcoded list of allowed models. Every time Anthropic releases a new model, the leaderboard stops working until the whitelist is manually updated.
Suggested Solution
Instead of maintaining a whitelist, use regex pattern matching to validate model names:
import re
# Pattern matches: claude-{model}-{version}-{date}
CLAUDE_MODEL_PATTERN = re.compile(
r'^claude-' # prefix
r'(opus|sonnet|haiku)' # model family
r'(-\d+(\.\d+)?)?' # optional version (e.g., -4, -4.5, -3-5)
r'-\d{8}$' # date suffix (YYYYMMDD)
)
def is_valid_model(model: str) -> bool:
return bool(CLAUDE_MODEL_PATTERN.match(model)) or model == 'unknown'This pattern would match:
- ✅
claude-opus-4-5-20251101 - ✅
claude-sonnet-4-5-20250929 - ✅
claude-sonnet-4-20250514 - ✅
claude-haiku-3-5-20241022 - ❌
gpt-4(not Claude) - ❌
random-string
Benefits
- Future-proof: New Claude models automatically work
- No maintenance: No need to update whitelist for each release
- Still secure: Only validates Claude model naming convention
Environment
- CLI Version: 0.2.9
- Model: claude-opus-4-5-20251101
- OS: macOS
Related
- Usage validation failed: Invalid or unknown model: claude-sonnet-4-5-20250929 #15 - Same issue for claude-sonnet-4-5-20250929
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels