@@ -5795,7 +5795,7 @@ func (bifrost *Bifrost) requestWorker(provider schemas.Provider, config *schemas
57955795 if len (supportedKeys ) == 0 {
57965796 // SkipKeySelection path — keyProvider stays nil, zero Key is used.
57975797 } else if ! canRotate {
5798- // Fixed key (DirectKey, explicit ID/name, session stickiness): always
5798+ // Fixed key (explicit ID/name, session stickiness): always
57995799 // return the same key regardless of usedKeyIDs.
58005800 fixedKey := supportedKeys [0 ]
58015801 keyProvider = func (_ map [string ]bool ) (schemas.Key , error ) {
@@ -7145,18 +7145,6 @@ func (bifrost *Bifrost) releaseMCPRequest(req *schemas.BifrostMCPRequest) {
71457145// getAllSupportedKeys retrieves all valid keys for a ListModels request.
71467146// allowing the provider to aggregate results from multiple keys.
71477147func (bifrost * Bifrost ) getAllSupportedKeys (ctx * schemas.BifrostContext , providerKey schemas.ModelProvider , baseProviderType schemas.ModelProvider ) ([]schemas.Key , error ) {
7148- // Check if key has been set in the context explicitly
7149- if ctx != nil {
7150- key , ok := ctx .Value (schemas .BifrostContextKeyDirectKey ).(schemas.Key )
7151- if ok {
7152- if err := validateKey (baseProviderType , & key ); err != nil {
7153- return nil , fmt .Errorf ("invalid direct key for provider %v: %w" , baseProviderType , err )
7154- }
7155- // If a direct key is specified, return it as a single-element slice
7156- return []schemas.Key {key }, nil
7157- }
7158- }
7159-
71607148 keys , err := bifrost .account .GetKeysForProvider (ctx , providerKey )
71617149 if err != nil {
71627150 return nil , err
@@ -7195,18 +7183,6 @@ func (bifrost *Bifrost) getAllSupportedKeys(ctx *schemas.BifrostContext, provide
71957183// For batch operations, only keys with UseForBatchAPI enabled are included.
71967184// Model filtering: if model is specified and key has model restrictions, only include if model is in list.
71977185func (bifrost * Bifrost ) getKeysForBatchAndFileOps (ctx * schemas.BifrostContext , providerKey schemas.ModelProvider , baseProviderType schemas.ModelProvider , model * string , isBatchOp bool ) ([]schemas.Key , error ) {
7198- // Check if key has been set in the context explicitly
7199- if ctx != nil {
7200- key , ok := ctx .Value (schemas .BifrostContextKeyDirectKey ).(schemas.Key )
7201- if ok {
7202- if err := validateKey (baseProviderType , & key ); err != nil {
7203- return nil , fmt .Errorf ("invalid direct key for provider %v: %w" , baseProviderType , err )
7204- }
7205- // If a direct key is specified, return it as a single-element slice
7206- return []schemas.Key {key }, nil
7207- }
7208- }
7209-
72107186 keys , err := bifrost .account .GetKeysForProvider (ctx , providerKey )
72117187 if err != nil {
72127188 return nil , err
@@ -7278,7 +7254,6 @@ func (bifrost *Bifrost) getKeysForBatchAndFileOps(ctx *schemas.BifrostContext, p
72787254// via the keyProvider closure built by the caller.
72797255//
72807256// canRotate=false is returned for cases where the caller must always use the same key:
7281- // - DirectKey (caller-supplied key bypasses all selection)
72827257// - SkipKeySelection (provider allows keyless requests; empty slice returned)
72837258// - Explicit BifrostContextKeyAPIKeyID / APIKeyName (user pinned a specific key)
72847259// - Session stickiness (key persisted in KV store for the session lifetime)
@@ -7287,15 +7262,6 @@ func (bifrost *Bifrost) getKeysForBatchAndFileOps(ctx *schemas.BifrostContext, p
72877262// canRotate=true is returned when there are two or more eligible keys and no pinning
72887263// or stickiness constraint is in effect.
72897264func (bifrost * Bifrost ) selectKeyFromProviderForModelWithPool (ctx * schemas.BifrostContext , requestType schemas.RequestType , providerKey schemas.ModelProvider , model string , baseProviderType schemas.ModelProvider ) ([]schemas.Key , bool , error ) {
7290- // DirectKey: caller supplied a key directly — no pool, no rotation.
7291- if ctx != nil {
7292- if key , ok := ctx .Value (schemas .BifrostContextKeyDirectKey ).(schemas.Key ); ok {
7293- if err := validateKey (baseProviderType , & key ); err != nil {
7294- return nil , false , fmt .Errorf ("invalid direct key for provider %v: %w" , baseProviderType , err )
7295- }
7296- return []schemas.Key {key }, false , nil
7297- }
7298- }
72997265 // SkipKeySelection: provider allows keyless requests — return empty pool, no rotation.
73007266 if skipKeySelection , ok := ctx .Value (schemas .BifrostContextKeySkipKeySelection ).(bool ); ok && skipKeySelection && isKeySkippingAllowed (providerKey ) {
73017267 return []schemas.Key {}, false , nil
0 commit comments