diff --git a/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs b/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs index b242e3f9..81d5f408 100644 --- a/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs +++ b/OpenAI-DotNet/Authentication/OpenAIClientSettings.cs @@ -56,16 +56,20 @@ public OpenAIClientSettings(string domain, string apiVersion = DefaultOpenAIApiV apiVersion = DefaultOpenAIApiVersion; } - ResourceName = domain.Contains(Http) - ? domain - : $"{Https}{domain}"; - - if (domain.Contains(Http)) + var httpSchema = Https; + if (domain.StartsWith(Http)) { + httpSchema = Http; domain = domain.Replace(Http, string.Empty); + } + else if (domain.StartsWith(Https)) + { + httpSchema = Https; domain = domain.Replace(Https, string.Empty); } + ResourceName = $"{httpSchema}{domain}"; + ApiVersion = apiVersion; DeploymentId = string.Empty; BaseRequest = $"/{ApiVersion}/";