An artificial intelligence research and deployment company, OpenAI focuses on the creation of safe, artificial, general intelligence. Their latest AI model, called ChatGPT, has the ability to interact with a user in a conversational tone.
When prompted, it composes responses relevant to the topic requested. Thunkable creators can utilize this model in their own apps and tap into the power of AI and natural language generation.
OpenAI no longer provides Free Trial credits. An OpenAI paid account is required to make API calls. Please see OpenAI pricing.
Create an OpenAI account and generate a secret API key
To use the OpenAI ChatGPT model in your Thunkable app, you need to generate a personal Open AI API key. To do this:
On the Overview page, click your avatar to show the menu and select View API Keys.
Select Create new secret key.
Copy the secret key that is provided in the popup window. You will need to paste this into your Thunkable project.
You will only be able to see your OpenAI API key once. You will not be able to copy it after the initial modal closes.
OpenAI Integration Setup in Thunkable
To setup the OpenAI integration in Thunkable:
Navigate to your projectโs Blocks tab.
Scroll to the bottom of the blocks panel on the left side to access the Advanced section.
Click the expand chevron to show the Advanced components.
Click the plus icon next to Open AI Services.
Your โOpen AI Servicesโ component will appear under the Open AI Services (Beta) drawer. Click the gear icon next to the component's name to access its properties dialog.
Paste your Open Secret API Key in the text box under APIKey (currently set to โdefaultโ).
Click Submit.
Properties
Once you have added at least one Open API component to your app, you will be able to view all of your Open API components under the OpenAPIs drawer in the Advanced section of the Blocks tab.
To edit the properties of an Open API component, click on the โ icon next to the component's name to bring up the properties dialog. You will be able to change the properties and click Done to save your changes, or click Delete to delete the component.
API Key
Property
Description
Data Type
API Key
Your person API for making requests to the OpenAI API (default key used if this field is left blank)
Text
Request Settings
Request Settings are passed as a list of Objects, or key-value pairs. In this modal, you can pass the property name and property value in their own fields.
See what kind of settings you can pass in OpenAI's Making Requests documentation.
Property
Description
Data Type
Property
Name of the property you are assigning a value to in your API request
Text
Value
Value of the property you are specifying in your API request
If an error is encountered while making the API call, returns the error
Text if an error is returned; else null
Properties
Set API Key
Set the API Key being used to make calls to the OpenAI API in your app. It is not required to use this block if you have set the OpenAI API in the properties dialog.
Get API Key
Get the API Key being used to make calls to the OpenAI API in your app
Ensure your OpenAI account has paid credits or auto-recharge set. OpenAI no longer offers Free Trial credits. See OpenAI billing.
Check that your prompt is correctly set before being sent to OpenAI.
Adding error handling to your OpenAI blocks can better help troubleshoot issues.
Have feedback on this doc? Please take a moment to share your feedback here: Thunkable Docs Feedback. Your valuable insights will help us improve and better serve you in the future.