function callGptApi(prompt) {
var apiKey = 'YOUR_API_KEY_HERE';
var url = 'https://api.openai.com/v1/chat/completions';
var payload = {
'model': 'gpt-3.5-turbo',
'messages': [{'role': 'user', 'content': prompt}]
};
var options = {
'method': 'post',
'contentType': 'application/json',
'headers': {
'Authorization': 'Bearer ' + apiKey
},
'payload': JSON.stringify(payload)
};
var response = UrlFetchApp.fetch(url, options);
var jsonResponse = JSON.parse(response.getContentText());
return jsonResponse.choices[0].message.content;
}