@@ -580,7 +580,7 @@ func (a *apiTranslator) translateBuiltinTool(
580580 }
581581 }
582582 if toolNeedsOpenaiApiKey (tool .Name ) {
583- if modelConfig .Spec .Provider != v1alpha1 .OpenAI {
583+ if ( modelConfig .Spec .Provider != v1alpha1 .OpenAI ) && modelConfig . Spec . Provider != v1alpha1 . AzureOpenAI {
584584 return nil , fmt .Errorf ("tool %s requires OpenAI API key, but model config is not OpenAI" , tool .Name )
585585 }
586586 apiKey , err := a .getModelConfigApiKey (ctx , modelConfig )
@@ -825,6 +825,7 @@ func addOpenaiApiKeyToConfig(
825825
826826// createModelClientForProvider creates a model client component based on the model provider
827827func (a * apiTranslator ) createModelClientForProvider (ctx context.Context , modelConfig * v1alpha1.ModelConfig , stream bool ) (* api.Component , error ) {
828+
828829 switch modelConfig .Spec .Provider {
829830 case v1alpha1 .Anthropic :
830831 apiKey , err := a .getModelConfigApiKey (ctx , modelConfig )
@@ -871,7 +872,7 @@ func (a *apiTranslator) createModelClientForProvider(ctx context.Context, modelC
871872 if err != nil {
872873 return nil , fmt .Errorf ("failed to convert Anthropic config: %w" , err )
873874 }
874-
875+ config . DefaultHeaders = modelConfig . Spec . DefaultHeaders
875876 return & api.Component {
876877 Provider : "autogen_ext.models.anthropic.AnthropicChatCompletionClient" ,
877878 ComponentType : "model" ,
@@ -921,7 +922,7 @@ func (a *apiTranslator) createModelClientForProvider(ctx context.Context, modelC
921922 }
922923 }
923924 }
924-
925+ config . DefaultHeaders = modelConfig . Spec . DefaultHeaders
925926 return & api.Component {
926927 Provider : "autogen_ext.models.openai.AzureOpenAIChatCompletionClient" ,
927928 ComponentType : "model" ,
@@ -993,6 +994,7 @@ func (a *apiTranslator) createModelClientForProvider(ctx context.Context, modelC
993994 }
994995 }
995996
997+ config .DefaultHeaders = modelConfig .Spec .DefaultHeaders
996998 return & api.Component {
997999 Provider : "autogen_ext.models.openai.OpenAIChatCompletionClient" ,
9981000 ComponentType : "model" ,
@@ -1018,6 +1020,7 @@ func (a *apiTranslator) createModelClientForProvider(ctx context.Context, modelC
10181020 }
10191021 }
10201022
1023+ config .Headers = modelConfig .Spec .DefaultHeaders
10211024 return & api.Component {
10221025 Provider : "autogen_ext.models.ollama.OllamaChatCompletionClient" ,
10231026 ComponentType : "model" ,
0 commit comments