You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: list models with all configured keys for provider (#700)
## Summary
Enhance the ListModels functionality to aggregate results from multiple API keys, improving model discovery and availability.
## Changes
- Modified `ListModels` interface to accept multiple keys instead of a single key
- Implemented key aggregation logic that combines model lists from multiple API keys
- Added deduplication of models based on model ID when aggregating results
- Created a best-effort approach that continues processing remaining keys even if some fail
- Added a new helper function `getAllSupportedKeys` to retrieve all valid keys for a provider
- Updated all provider implementations to support the multi-key approach
## Type of change
- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI
## Affected areas
- [x] Core (Go)
- [ ] Transports (HTTP)
- [x] Providers/Integrations
- [ ] Plugins
- [ ] UI (Next.js)
- [ ] Docs
## How to test
Test the ListModels endpoint with multiple API keys configured for the same provider:
```sh
# Core/Transports
go version
go test ./...
# Test with multiple keys for a provider (e.g., OpenAI)
curl -X GET "http://localhost:8000/v1/models?provider=openai" -H "Authorization: Bearer your-bifrost-token"
```
## Breaking changes
- [ ] Yes
- [x] No
## Related issues
Improves model discovery by aggregating results from multiple API keys.
## Security considerations
The implementation maintains the same security model as before, with proper error handling to avoid leaking sensitive information.
## Checklist
- [x] I added/updated tests where appropriate
- [x] I verified builds succeed (Go and UI)
- [x] I verified the CI pipeline passes locally if applicable
bifrost.logger.Warn(fmt.Sprintf("failed to list models for provider %s: %v", providerKey, bifrostErr.Error.Message))
326
+
iterations:=0
327
+
for {
328
+
// check for context cancellation
329
+
select {
330
+
case<-ctx.Done():
331
+
bifrost.logger.Warn(fmt.Sprintf("context cancelled for provider %s", providerKey))
332
+
return
333
+
default:
335
334
}
336
-
iffirstError==nil {
337
-
firstError=bifrostErr
335
+
336
+
iterations++
337
+
ifiterations>schemas.MaxPaginationRequests {
338
+
bifrost.logger.Warn(fmt.Sprintf("reached maximum pagination requests (%d) for provider %s, please increase the page size", schemas.MaxPaginationRequests, providerKey))
0 commit comments