I’m getting The request was aborted: Could not create SSL/TLS secure channel exception calling openai api from windows 2012 and 2016 server. It runs on my dev box (localhost, windows 10 pro).
Any suggestions?
I can’t post my question here, so I’m linking to StackOverflow:
[The request was aborted: Could not create SSL/TLS secure channel exception calling openai api from windows 2003 server]
This is the c# code:
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
var body = JsonConvert.SerializeObject(model);
var client = new RestClient("https://api.openai.com/v1/chat/completions");
var request = new RestRequest
{
Method = Method.Post
};
request.AddParameter("application/json", body, ParameterType.RequestBody);
request.AddHeader("Authorization", $"Bearer {Config.AppSettings.OpenAiApiKey}");
var response = await client.ExecuteAsync(request);
return response.Content;