Thunkable Docs
Build an AppDrag and Drop DocsSnap to Place DocsAcademy
Drag and Drop
Drag and Drop
  • What is Thunkable?
  • 🗺️Getting Started
    • Gen AI
      • Prompt Engineering
      • AI tools
      • AI Chatbot Helper
      • AI Template Generator
    • Getting Started Guide
    • Keyboard Shortcuts
    • Undo Redo
    • Thunkable Account
      • Account Management
    • Preview and Test your App
    • Versioning
    • Data Sources
      • Google Sheets Data Source
      • Airtable Data Source
      • Webflow Data Source
      • Local Table Data Source
    • Project Collaboration
      • Organizations
    • 🎓Sample Apps & Tutorials
      • Thunkable Community Forums
      • Sample Apps
      • Video Tutorials
        • Thunkable Live App
          • How to Test and Troubleshoot with Thunkable Live App
        • Data Source Tutorials
          • Connecting to Data Sources
            • Google Sheets
            • Local Table
          • Create Data in a Thunkable Data Source
          • Read Data in a Thunkable Data Source
          • Update Data in a Thunkable Data Source
          • Delete Data in a Thunkable Data Source
        • User Auth & Management
          • Firebase
            • User Sign-Up, Sign-In, and Auth
            • User Sign Out and Password Reset
          • Google
            • User Sign-Up, Sign-In, Sign-Out, and Auth
          • Apple
            • User Sign-Up, Sign-In, Sign-Out, and Auth
        • Projects
          • How to Save Versions of Your Thunkable Project
          • How to Copy and Customize Public or Sample Thunkable Projects
        • User Interface & Design
          • Screens
            • Save and Reuse Thunkable Screens
            • Change Thunkable Screens with a Button Click
            • Create Scrollable Screens in Your Thunkable App
          • Navigators
            • How to Use the Thunkable Stack Navigator
            • How to Use Thunkable Top and Bottom Tab Navigators
            • How to Use the Thunkable Drawer Navigator
            • Combine Figma Frames with Thunkable Navigators
          • Components
            • How to Use the Visibility Property to Create Modals in Thunkable
          • Data Visualization
            • Customize a Data Viewer
          • Text
            • Implement Text Input Validation
        • Alerts & Notifications
          • Display Alert Messages in Your Thunkable App
          • How to Create Three-Button Alert Messages
        • Files
          • Cloudinary
            • Store and Access Cloudinary Files in Your Thunkable App
        • Camera
          • How to Use the Device’s Camera
          • How to Use the Device’s Video Camera
          • Use the Device’s Camera as a QR or Barcode Scanner
        • Realtime Databases
          • Firebase
            • How to Read Data in a Firebase Realtime Database
            • How to Update Data in a Firebase Realtime Database
        • Advanced Blocks
          • Connect Your Thunkable App to a Web API
        • Thunkable Academy
          • Building Your First Thunkable App
            • Getting Started with Thunkable
            • How to Design a Thunkable App
            • How to Connect a Thunkable App to a Data Source
            • How to Make A Thunkable App Interactive with Blocks
          • Thunkable No Code App Creation Basics
            • Thunkable UI Components and App Features
            • Understanding Thunkable's Drag and Drop Block Builder
            • Design, Develop, Debug, and Deploy Your App
        • Hour of Code
          • 2021 - Build an Informational App
          • 2022 - Build a Scavenger Hunt App
          • 2023 - Build a Translator and Text-to-Speech App
        • App Building
          • How to Build a Translation App in Thunkable
          • How to Create an Image Recognition App with Thunkable
          • How to Create a Text-to-Speech App in Thunkable
  • 🎨App Design
    • User Interface (UI) Components
      • Basic Components
        • Button Component
        • Label Component
        • Rich Text Component
        • Image Component
        • Text Input Component
        • Layout Component
        • Group Component
      • Data Components
        • Simple List Component
        • Data Viewer Components
          • Data Viewer List Component
          • Data Viewer Grid Component
          • Custom Data Viewer
      • Input Components
        • Switch Component
        • Slider Component
        • Checkbox Component
        • Date Input Component
        • Time Input Component
      • Media Components
        • Animation Component
        • Video Component
        • Loading Icon Component
      • Embed Components
        • Web Viewer Component
        • Map Component
        • Canvas Component
        • PDF Reader Component
        • Rating Component
      • Modules
        • Introduction
        • User Guide
      • Generative AI
    • Screens
      • Save and Reuse Screens
      • Improve Thunkable Load Time
    • Navigators
      • Top Tab Navigator
      • Bottom Tab Navigator
      • Drawer Navigator
      • Stack Navigator
    • Figma Integration
  • 🛠️Blocks
    • Thunkable Blocks Overview
    • Core Blocks
      • Control Blocks
      • Logic Blocks
      • Math Blocks
      • Text Blocks
      • Lists Blocks
      • Color Blocks
      • Device Blocks
      • Objects Blocks
      • Variables Overview
        • Connect a Firebase Realtime Database
        • Variables Blocks
      • Functions Blocks
    • App Features Blocks
      • Speech Blocks
      • Sound Blocks
      • Share Blocks
      • Camera Blocks
      • Files Blocks
      • Sign In Blocks
        • User Sign Up, Sign In, and Authentication with Firebase
        • User Sign Up, Sign In, and Authentication with Google
        • User Sign Up, Sign In, and Authentication with Apple
      • Location Blocks
      • Push Notification Blocks
      • In-App Purchase Blocks (with RevenueCat)
      • Data Sources Blocks
      • Alerts Blocks
      • Timer Blocks
      • Sensors Blocks
        • Gyroscope
        • Magnetometer
        • Accelerometer
        • Location Sensor
      • Ads by AdMob
    • Advanced Blocks
      • Web APIs Blocks
        • CORS Policy
        • 🆓No Auth APIs
          • Update Data in a Data Source
          • CRUD Operations
          • Setting Headers
        • 📊Charting APIs
          • Create a chart template
          • Charting in Thunkable
      • Bluetooth Low Energy Blocks
      • OpenAI Services ChatGPT Integration Blocks
      • "Any Component" Blocks
      • JavaScript Web Bridge
  • ⚙️Settings
    • App Settings
      • Tablet View
    • Assets
    • Cloud Variable Viewer
    • Manage your Projects
      • My Projects Page
      • Thunkable Projects
      • Duplicate Project
      • Share Your App
      • Download Your App
        • Download Your App on iOS
        • Download Your App on Android
      • Add to Home Screen
      • Managing Project Storage
      • App Data Privacy
      • Delete Project
  • 📱Publishing
    • Overview
    • Publish to the Apple App Store
      • User Guide
      • Troubleshooting
      • Review Process
      • Tracking Usage Description
    • Publish to Google Play Store
      • User Guide
      • Troubleshooting
      • Review Process
    • Publish as a Web App
      • User Guide
      • Custom Domains
      • Troubleshooting
    • Testing
      • Testing on iOS via TestFlight
      • Testing on Android
    • Troubleshooting
      • Publishing Checklist
      • Generate Screenshots
  • 🎮Gaming
    • Gaming Overview
      • Canvas Label
      • Sprites
      • Sprite Gallery
    • Gaming Blocks
      • Events
      • Motion
      • Looks
      • Direction
      • Sensing
      • Add & Remove
      • Stage
  • 🗃️Additional Resources
    • Release Notes
      • Release Notes 2025
      • Release Notes 2024
      • Release Notes 2023
    • Troubleshooting
      • Can't Sign in to Thunkable?
      • FAQs
    • Minimum Requirements
    • Bugs and Product Feedback
    • App Services and Emulators
Powered by GitBook
On this page
  • Overview
  • Create an OpenAI account and generate a secret API key
  • OpenAI Integration Setup in Thunkable
  • Properties
  • API Key
  • Request Settings
  • Blocks
  • Functions
  • Properties
  • Create a Thunkable Project Using the OpenAI Integration
  • Design Tab: Design the App’s User Interface
  • Troubleshooting

Was this helpful?

Export as PDF
  1. Blocks
  2. Advanced Blocks

OpenAI Services ChatGPT Integration Blocks

PreviousBluetooth Low Energy BlocksNext"Any Component" Blocks

Last updated 2 months ago

Was this helpful?

Overview

An artificial intelligence research and deployment company, 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 .

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:

  1. Navigate to

  2. Click Sign Up.

  3. On the Overview page, click your avatar to show the menu and select View API Keys.

  4. Select Create new secret key.

  5. 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:

  1. Navigate to your project’s Blocks tab.

  2. Scroll to the bottom of the blocks panel on the left side to access the Advanced section.

  3. Click the expand chevron to show the Advanced components.

  4. Click the plus icon next to Open AI Services.

  5. 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.

  6. Paste your Open Secret API Key in the text box under APIKey (currently set to ‘default’).

  7. 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

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

Text

Blocks

Functions

Call Text Completion

Input Name
Description
Data Type
Required?

Prompt

Text prompt for OpenAI to generate text around

Text

Yes

Output Name
Description
Data Type

response

Generated Text from OpenAI API

Text

error

If an error is encountered while making the API call, returns the error

Text if an error is returned; else null

Call Image Generation

Input Name
Description
Data Type
Required?

Prompt

Text prompt for OpenAI to generate image

Text

Yes

Output Name
Description
Data Type

response

Generated Image from OpenAI API

Image

error

If an error is encountered while making the API call, returns the error

Text if an error is returned; else null

Call Text with Image

Input Name
Description
Data Type
Required?

Prompt

Text prompt for OpenAI to generate text around

Text

No

Image

Image URL or Image base64 type

Image

Yes

Output Name
Description
Data Type

response

Generated Text from OpenAI API

Text

error

If an error is encountered while making the API call, returns the error

Text if an error is returned; else null

Call Text to Speech

Input Name
Description
Data Type
Required?

Prompt

Text prompt for OpenAI to generate speech

Text

Yes

Voice name

The voice that will speak the output

Text

Yes

Output Name
Description
Data Type

error

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

Set API Request Settings

Get API Request Settings

Create a Thunkable Project Using the OpenAI Integration

Design Tab: Design the App’s User Interface

To utilize the OpenAI ChatGPT integration, your Thunkable project will need a minimum of:

  • One text input

  • One label

  • Two buttons

  • One image component

Below is a sample minimum viable product design:

To use the OpenAI integration to display text and an image from a query, recreate the following block combination.

Users of this app enter a prompt into the text input.

The app calls the OpenAI API and populates the label and image components when the 'Text' or 'Image' button is clicked.

The label component shows the text output from the OpenAI model. The image component shows the image output from the OpenAI model.

Troubleshooting

If you are getting undefined or errors in your response from OpenAI calls, try the following.

  • Check that your prompt is correctly set before being sent to OpenAI.

Adding error handling to your OpenAI blocks can better help troubleshoot issues.

Request Settings are passed as a of , 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 documentation.

Make a call to

Make a call to

Make a call to

Make a call to

Use and blocks to set the of your call to the OpenAI API

Get the of your call to the OpenAI API

Your Request Settings will be returned as a of

Check that your .

Ensure your OpenAI account has paid credits or auto-recharge set. OpenAI no longer offers Free Trial credits. See .

Have feedback on this doc? Please take a moment to share your feedback here: . Your valuable insights will help us improve and better serve you in the future.

🛠️
OpenAI
OpenAI pricing
https://openai.com/api/
list
Objects
Making Requests
OpenAI's Completion model
OpenAI's Create Image model
OpenAI's Vision model
OpenAI's Text to speech model
lists
Objects
Request Settings
Request Settings
list
Objects
OpenAI secret key is configured
OpenAI billing
Thunkable Docs Feedback