The App Inventor ChatBot component provides an easy to use interface to several different large language models. The particular model used is determined by the chatbot component’s provider property. New providers are appearing regularly, and you can experiment with different choices.

By default, the App Inventor component uses OpenAI’s ChatGPT 3.5-turbo model. MIT has an account which is used by default if you do not specify your own account. However, to keep our costs under control, we permit only limited usage over any 24-hour period. This is usually enough for people to get started.

If you are going to develop a significant application, you will quickly exceed this quota. Doing so generates an Error, “429 Over Quota.”1

You’ll therefore need to provide an API key to include in your app, and bill it to an OpenAI credit card account. Also, teachers using the chatbot with a class might also find that MIT’s default quota is not adequate student use. Here again, the teacher should provide keys for students to use in their chatbot projects. This could be a single key for the entire class, or separate keys for students or groups to share.

This memo shows how to create keys for OpenAI’s ChatGPT. At some point, OpenAI offered a free $5 credit, which could be used even without a credit card. But this may no longer be the case at the time you are reading this document.

The first step is to create an account. Go to https://platform.openai.com, you should be greeted by a page which looks like this:

Note: some parts of the page that do not contain relevant information have been cut off in the figures.

If you do not already have an account with OpenAI, click the “Sign up” link in the upper right-hand corner.

This should take you to a page which looks like this:

Enter your email address and press continue. The site will walk you through setting up a password for your account. Alternatively, you can click one of the other choices, which will then create an OpenAI account and link it to the provider you chose (Google, Microsoft or Apple).

You may have to login manually once your account is created. Back on the main page, click the “Log in” button and continue. You should wind up here:

Click the “Dashboard” link in the upper right-hand corner. You should then wind up here:

Look on the left-hand side of the page. The last option (at least the last option today) is “API Keys” which will bring you here:

Now click the green “Create new secret key” button in the upper right-hand corner.

You can give your key a name, but it is not required. Press the green “Create Secret Key” button. You should then get a display that looks like this:

You should copy down the displayed API key. This is the key you will enter into MIT App Inventor to use the ChatBot Component with your account. In the MIT App Inventor designer:

Important: This API key will work only when the provider is set to “chatgpt.” Other providers are provided by other companies that have their own API key system.

  1. The 429 code is a Web code that means “too many requests.” But don’t worry about that. For our purposes, it means that you need to create your own account!