Skip to main content

ChatGPT

About 5 min · Quick setup

Add AI answers and writing to your app with your own OpenAI account. People ask a question in your app, your app's own server asks OpenAI with your key, and the answer appears word by word.

What you can build​

FeatureAsk chat
A chatbot that knows your app"Build a context-aware chatbot"
A menu or product assistant"Add an AI assistant that answers questions about my menu"
Writing help"Let users generate product descriptions"
Summaries"Summarise each customer review with AI"

ChatGPT powers features inside your app. It isn't for text you write once, such as your About page: ask chat to write that directly.

Before you start​

  • Your app's backend, set up in Database & Backend. See Your app needs a backend first.
  • An OpenAI API account with billing. A ChatGPT Plus or Pro subscription doesn't include API use. See OpenAI's pricing.

Get your API key​

Create a project just for this app

In the OpenAI platform, create a new project. Keeping one app per project keeps its costs and key separate.

Set a monthly hard spend limit

In the project's settings, open Limits, select Edit spend limit, enter a monthly amount and turn on Enforce a hard limit. See OpenAI's Spend limits.

Create a restricted key

Open API keys in that project and create a key. Choose Restricted and allow only Models (read) and Responses (write).

OpenAI's quickstart shows where keys are created. The Hub links to it as How to get your OpenAI key.

Add an AI feature​

Ask chat for the feature

For example "Build a context-aware chatbot". If you haven't named an AI, chat asks Which AI should power this? Pick ChatGPT.

Say what the AI should do

Chat shows What should the AI do in your app, with three ideas and Write your own. For a chat feature it also asks Should the chatbot remember the conversation?

Paste your key

The Connect ChatGPT window opens. Paste your OpenAI project API key. Under Please confirm, tick Your OpenAI project has a monthly hard spend limit.

Select Connect

The window shows Connected. Chat is building it now. When chat finishes, a card says your feature is ready, with Try it in the preview.

Chat card asking what the AI should do in the app, with three ideas and Write your own
Chat asks what the AI should do, with three ideas and Write your own.
Connect ChatGPT window in chat with the OpenAI project API key field and spend-limit confirmation
The Connect ChatGPT window: paste your OpenAI project API key and confirm the spend limit.
Chat card saying the AI feature is ready, with Try it in the preview
When chat finishes, a card says your feature is ready, with Try it in the preview.

You paste the key once. Your next AI features in this app reuse it. See Integrations in chat for every card chat shows.

tip

You can also start from the Hub: open ChatGPT, describe the feature under What should the AI do?, and select Send to chat.

Your choices​

The Connect window shows We picked the usual choices. Select Change to adjust them. You can change them later under Settings without rebuilding your app.

QuestionOptions
Which OpenAI models may this app use?Fast and low cost (the usual choice), Balanced, or Most capable, which costs the most. See OpenAI's models.
Only signed-in people can use AI?No is the usual choice. Yes needs sign-in in your app and stops strangers using up your OpenAI credit.
Should the chatbot remember the conversation?No memory, Remember this visit (the usual choice, kept in the visitor's browser), or Remember across visits (saved in your app's database for people who are signed in). Remembering uses more tokens.
Where OpenAI handles requestsLeave it on api.openai.com unless OpenAI approved data residency for your project. The UAE is ae.api.openai.com. See OpenAI's data controls.

Try it​

Open the preview in a new tab and ask the AI a question. The answer appears word by word. In the Hub, ChatGPT then shows Working in your app.

Usage and costs​

Open ChatGPT in the Hub to see Usage, "Last 7 days, from this app's own log": requests, input tokens, output tokens, and how many were busy (limited).

The ChatGPT page in the Integration Hub after setup, showing In your app features, Files, Add another AI feature, and Usage for the last 7 days
After setup, ChatGPT's Overview shows what is in your app, its files, a prompt for another feature, and Usage from this app's own log.
Who paysOpenAI bills every answer to your account. TatbiQ adds no fees. Adding a feature is a chat edit and uses credits.
Per visitorUp to 20 answers every 10 minutes. See AI usage limits.
Your capOnly OpenAI's hard spend limit caps your bill.

Manage and remove​

Once ChatGPT is in your app, its page has two tabs:

  • Overview, under In your app: its status, the files it uses, Usage, and Add another AI feature... to describe a new one and send it to chat.
  • Settings: your key, and your choices.

Replace your key or remove ChatGPT the same way as any service. See Connect and manage. Removing ChatGPT keeps its usage log in your database.

Troubleshooting​

You seeWhat to do
"ChatGPT stopped requests: the spend limit or credit ran out"Your key is fine. Raise the limit or add credit in your OpenAI account, then check again.
"ChatGPT stopped accepting your keys. Paste them again to fix it."Create a new key in OpenAI. In the Hub, select Fix it and paste it.
Visitors see "The AI is busy right now. Please try again in a moment."That visitor reached 20 answers in 10 minutes. It clears by itself.
Visitors see "Please sign in to use the AI."You chose Yes for Only signed-in people can use AI?. Change it under Settings if you didn't mean to.
"This AI model is not enabled for this app."The feature asks for a model outside your choice. Pick a wider option under Which OpenAI models may this app use?
"AI is not enabled for this website address yet."Your app has a new address, such as a new domain. Open Settings, then Advanced, and select Set up again.

FAQ​

Is there a test mode?​

No. OpenAI has no test mode, so the feature is live as soon as chat adds it. Set a spend limit before you share your app.

Can I use my ChatGPT Plus subscription?​

No. ChatGPT subscriptions don't include API use. You need an OpenAI API account with billing.

Does TatbiQ see or keep what people ask?​

No. The server function logs only counts and token numbers. Messages are saved only if you chose Remember across visits, and then in your app's own database.

Can I add more than one AI feature?​

Yes. Ask chat, or use Add another AI feature... in the Hub. They all use the same key.