I have a program in Word VBA that has been running fine for over a year or more. I am using model gpt-4o-mini and verified the end points. I have tried pretty much every possible solution regarding registry entries and resetting network settings, but I still haven’t had any luck.
Here is a sample of the code I am using which errors out on the send line.
Set httpRequest = CreateObject(“WinHttp.WinHttpRequest.5.1”)
'Set httpRequest = CreateObject(“MSXML2.ServerXMLHTTP.6.0”)
httpRequest.setTimeouts 120000, 120000, 120000, 120000 ' This sets all timeout values to 60 second
Dim messages As String
messages = """messages"": [" & _
"{""role"": ""system"", ""content"": ""You are a highly skilled RFP specialist.""}," & _
"{""role"": ""user"", ""content"": """ & Prompt & """}" & _
"]"
requestBody = "{" & _
"""model"": ""gpt-4o-mini""," & _
messages & "," & _
"""max_tokens"": " & maxTokensToUse & "," & _
"""temperature"": 0.0" & _
"}"
With httpRequest
.Open "POST", API_ENDPOINT, False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Authorization", "Bearer API KEY HERE-NOT ENTERING HERE FOR OBVIOUS REASONS"
.Send (requestBody)
End With