diff --git a/pkg/providers/openai_compat/provider.go b/pkg/providers/openai_compat/provider.go index 938e4ea8b..9b942d882 100644 --- a/pkg/providers/openai_compat/provider.go +++ b/pkg/providers/openai_compat/provider.go @@ -417,7 +417,9 @@ func isNativeSearchHost(apiBase string) bool { return false } host := u.Hostname() - return host == "api.openai.com" || strings.HasSuffix(host, ".openai.azure.com") + return host == "api.openai.com" || + strings.HasSuffix(host, ".openai.azure.com") || + strings.HasSuffix(host, ".services.ai.azure.com") } // supportsPromptCacheKey reports whether the given API base is known to @@ -430,5 +432,7 @@ func supportsPromptCacheKey(apiBase string) bool { return false } host := u.Hostname() - return host == "api.openai.com" || strings.HasSuffix(host, ".openai.azure.com") + return host == "api.openai.com" || + strings.HasSuffix(host, ".openai.azure.com") || + strings.HasSuffix(host, ".services.ai.azure.com") } diff --git a/pkg/providers/openai_compat/provider_test.go b/pkg/providers/openai_compat/provider_test.go index efb03ccb8..fc8df6302 100644 --- a/pkg/providers/openai_compat/provider_test.go +++ b/pkg/providers/openai_compat/provider_test.go @@ -831,6 +831,8 @@ func TestSupportsPromptCacheKey(t *testing.T) { {"https://api.groq.com/openai/v1", false}, {"http://localhost:11434/v1", false}, {"https://openrouter.ai/api/v1", false}, + {"https://myfoundry.eastus.services.ai.azure.com/v1", true}, + {"https://myfoundry.services.ai.azure.com", true}, // Edge cases: proxy URLs with openai.com in path should NOT match {"https://my-proxy.com/api.openai.com/v1", false}, {"https://proxy.example.com/openai.azure.com/v1", false}, @@ -900,6 +902,7 @@ func TestIsNativeSearchHost(t *testing.T) { {"https://api.deepseek.com/v1", false}, {"https://api.groq.com/openai/v1", false}, {"http://localhost:11434/v1", false}, + {"https://myfoundry.eastus.services.ai.azure.com/v1", true}, {"", false}, } for _, tt := range tests {