Use OpenAI ChatGPT in Airtable For Free
Easily use ChatGPT in your Airtable base for free, in 15 minutes or less with this simple method. See our YouTube video here and our code below
The code
const CHATGPT_API_KEY = "PASTE YOUR API KEY HERE"; const {a} = input.config() let openaiUrl = "https://api.openai.com/v1/chat/completions"; console.log({a}); let body = { "model": "gpt-3.5-turbo", // Other Options: "text-davinci-002", "gpt-4" "messages": [ { "role": "user", "content": a } ], "temperature": 0.7 // Number between 0 and 1. Higher number = More randomness. } let headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${CHATGPT_API_KEY}`, } let response = await fetch(openaiUrl, { method: 'POST', body: JSON.stringify(body), headers, }); try { let data = await response.json(); console.log({data}); const answer = data.choices[0].message.content output.set('response', `${answer}`); } catch(e) { console.error('error saving response from chatGPT', e); throw e; }
Blog post tutorial coming soon!