Skip to content
aeropage-round-dark
Aeropage Documentation
Dynamic Tools and APIs

OpenAI Connector

This tool allows you to send prompts to the same engine that powers ChatGPT, by mixing static and dynamic values from your Airtable records.

Before you Begin

This tool is primarily intended to let you automate messages between OpenAI and Airtable, this is different than bulk processing.

Create your OpenAPI Key

To connect to the openai API you will need a key. A free trial account will give you some credit to use with the api, and a fairly slow rate limit. You can check your usage with the links below, add more credit and increase your rate limit too.

Check your usage :

blunt-bulb
From our experience, short requests cost about $0.01 per record / call so the free credit can be used a lot before upgrading.

Setup your Connector

The user interface…


1 - Choose whether you want text or image url returned based on your prompt
2 - Your message for artificial intelligence
3 - Choose which record to use in your prompt.
4 - Redirects to AI's answer.
7 - Redirects to api endpoint AI's answer.

Untitled.png

Api key

Make sure you have your api key specified. If no click ‘here’ and specify it there.
Untitled 1.png

Untitled 2.png
When you specified an open ai api key you can go back to editor page and choose mode

Untitled 3.png

Modes:

Text - returns text as a response
Image(not available now) - returns image as a response

Prompt

You can write your question here.
Untitled 4.png

When you finished, click:

Preview(1) which redirects AI's answer.

Untitled 5.png

Api endpoint(2) which redirects to enpoint with AI's answer.
Untitled 6.png

Connect your Automations

Now from Airtable, Zapier or Make (or other systems) you can send a request to your endpoint with a script - and include the record id that you want to use in the prompt. The response will come back, and you can use it in any workflow you want.

Airtable


Create new automation.
Untitled 7.png


Add two actions:
Run a script
Update record
Untitled 8.png

Run a script


Copy the script here into your automation…
let inputConfig = input.config();
let apiUrl = '[paste your sharing link here]' + inputConfig.recordid;
let apiResponse = await fetch(apiUrl);
let data = await apiResponse.text();
if (apiResponse.status == 200) output.set('openai', data)
else throw Error("No valid response. Aborting so no openai response is sent.")

Copy the Sharing Link for your project
Untitled 9.png

blunt-bulb
Make sure you replace the ‘sharing link’ in the script with the one you copied in the previous step…

We also need to add an Input variable for the record id.
Untitled 10.png
Give it the name recordid and for the value, click the [+] and then choose Airtable record ID
Untitled 11.png

When you have done the steps above, click Test and you should see a successful result like this …

Untitled 12.png

Update Record


Firstly enter a description for this action.

Untitled 13.png

Select a table where is the field that you want to update.

Untitled 14.png

In ‘Record ID’ section select ‘Airtable record ID’.
Untitled 15.png

Finally select a field that you want to update and then ‘openai’ from ‘Run a script’

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.