Simple call to ChatGPT API using 4D.HTTPRequest
You need an API Key, by loging to openai and get one here https://beta.openai.com/account/api-keys
$chat:=cs.ChatGPT.new()
$chat.token:="xxx" // get it from https://beta.openai.com/account/api-keys
$result:=$chat.prompt($prompt)
$allMessages=$result.choices.map(Formula($1.value.text)).join("\n"))
see test.4dm for a full example
For instance I ask if ChatGTP know the 4D Language (to code for me)