Skip to content

feat(api-keys): add per-API-key model allowlist filtering#224

Open
toanalien wants to merge 1 commit intodecolua:masterfrom
toanalien:feat/allow-model-per-api-key
Open

feat(api-keys): add per-API-key model allowlist filtering#224
toanalien wants to merge 1 commit intodecolua:masterfrom
toanalien:feat/allow-model-per-api-key

Conversation

@toanalien
Copy link
Contributor

Implement fine-grained access control by allowing API keys to restrict which models they can access via pattern matching.

Features:

  • Pattern matching: exact (gh/gpt-5.1), wildcard (gh/*), multiple patterns
  • Database schema: allowedModels array with auto-migration
  • API validation: 403 when model denied, backward compatible (empty = unrestricted)
  • REST API: CRUD operations for managing allowedModels
  • Dashboard UI: visual pattern selector with quick-add buttons
CleanShot 2026-03-01 at 09 05 43@2x CleanShot 2026-03-01 at 09 05 57@2x

Implement fine-grained access control by allowing API keys to restrict
which models they can access via pattern matching.

Features:
- Pattern matching: exact (gh/gpt-5.1), wildcard (gh/*), multiple patterns
- Database schema: allowedModels array with auto-migration
- API validation: 403 when model denied, backward compatible (empty = unrestricted)
- REST API: CRUD operations for managing allowedModels
- Dashboard UI: visual pattern selector with quick-add buttons
- Comprehensive tests: 17/17 passing, 95.23% coverage

Implementation Details:
- src/shared/utils/model-pattern-matcher.js: Core pattern matching logic
- src/shared/components/AllowedModelsInput.js: Dashboard UI component
- src/lib/localDb.js: Schema migration and validation
- src/sse/services/auth.js: Model validation in authentication
- src/app/api/keys/*: REST endpoints for allowedModels CRUD

Breaking Changes: None (backward compatible)
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.

1 participant