@@ -2609,8 +2609,9 @@ async function preValidateCredentialInputs(
26092609 model : string
26102610 } > = [ ]
26112611
2612- const hostedModels = isHosted ? getHostedModels ( ) : [ ]
2613- const hostedModelsLower = new Set ( hostedModels . map ( ( m ) => m . toLowerCase ( ) ) )
2612+ const hostedModelsLower = isHosted
2613+ ? new Set ( getHostedModels ( ) . map ( ( m ) => m . toLowerCase ( ) ) )
2614+ : null
26142615
26152616 operations . forEach ( ( op , opIndex ) => {
26162617 if ( ! op . params ?. inputs || ! op . params ?. type ) return
@@ -2635,7 +2636,7 @@ async function preValidateCredentialInputs(
26352636 }
26362637
26372638 // Check for apiKey inputs on hosted models
2638- if ( isHosted && op . params . inputs . apiKey ) {
2639+ if ( hostedModelsLower && op . params . inputs . apiKey ) {
26392640 const modelValue = op . params . inputs . model
26402641 if ( modelValue && typeof modelValue === 'string' ) {
26412642 if ( hostedModelsLower . has ( modelValue . toLowerCase ( ) ) ) {
@@ -2658,7 +2659,7 @@ async function preValidateCredentialInputs(
26582659 }
26592660
26602661 // Deep clone operations so we can modify them
2661- const filteredOperations = JSON . parse ( JSON . stringify ( operations ) ) as EditWorkflowOperation [ ]
2662+ const filteredOperations = structuredClone ( operations )
26622663
26632664 // Filter out apiKey inputs for hosted models
26642665 if ( hasHostedApiKeysToFilter ) {
@@ -2668,19 +2669,11 @@ async function preValidateCredentialInputs(
26682669 const op = filteredOperations [ apiKeyInput . operationIndex ]
26692670 if ( op . params ?. inputs ?. apiKey ) {
26702671 delete op . params . inputs . apiKey
2671- logger . info ( 'Removed apiKey for hosted model', {
2672+ logger . debug ( 'Silently filtered apiKey for hosted model', {
26722673 blockId : apiKeyInput . blockId ,
26732674 model : apiKeyInput . model ,
26742675 } )
26752676 }
2676-
2677- errors . push ( {
2678- blockId : apiKeyInput . blockId ,
2679- blockType : apiKeyInput . blockType ,
2680- field : 'apiKey' ,
2681- value : '[redacted]' ,
2682- error : `API key not allowed for hosted model "${ apiKeyInput . model } " - platform provides the key` ,
2683- } )
26842677 }
26852678 }
26862679
0 commit comments