I have made some research, some said I have to hardcoded but using obfuscation in my client app, I see this may be a easy way. But I am not sure for the following reason:
So do we have some official solution or any existing tutorial how to handle the connection between chatgpt api and flutter app?
==============Update===============
Hi Alex I have read your medium article and have following questions:
Is it safe to use firebase extension where I input my openai api-key? I am confused where to save this openai api-key in the end: Google Cloud Console/Secret manager or Chatbot with ChatGPT Firebase Extension?
I know flutter instead of android, from my understanding in your resource, it seems a user can directly connect with firebase and chatgpt since I input my openai apikey in the Chatbot with ChatGPT Firebase Extension, so how can we control how many tokens this user is allowed to use?
Do you have also some article introducing the third-party-payment api such as stripes or revenueCat, so firebase knows the specific user is a premium user and give more chatgpt quota?
Thanks!
If want to save the OpenAI API Key on the client, which I recommend against it, you can indeed do it by obfuscating it, but the safest place would be to store it in Google Cloud. So you should open your Google Cloud Console, select your project, then go to the Secret Manager at:
And create your secret key. The benefit of using this approach is that the encryption is managed by Google. So you don't have to worry about it.