From 7200ecb7fec2b62d877b2db6bdfdef312b454740 Mon Sep 17 00:00:00 2001 From: badgerbees <93577481+badgerbees@users.noreply.github.com> Date: Sat, 21 Mar 2026 07:33:18 +0700 Subject: [PATCH] feat(providers): add native Azure OpenAI and Foundry header support (#319) --- internal/providers/openai.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/providers/openai.go b/internal/providers/openai.go index 9a1c014a..366fdf48 100644 --- a/internal/providers/openai.go +++ b/internal/providers/openai.go @@ -412,7 +412,12 @@ func (p *OpenAIProvider) doRequest(ctx context.Context, body any) (io.ReadCloser } httpReq.Header.Set("Content-Type", "application/json") - httpReq.Header.Set("Authorization", "Bearer "+p.apiKey) + // Azure OpenAI/Foundry support for now atleast + if strings.Contains(strings.ToLower(p.apiBase), "azure.com") { + httpReq.Header.Set("api-key", p.apiKey) + } else { + httpReq.Header.Set("Authorization", "Bearer "+p.apiKey) + } resp, err := p.client.Do(httpReq) if err != nil {