Short answer: Never put an OpenAI, Gemini or Claude API key inside a Flutter app, because anyone can pull it out of the install file. Put a small backend in between: the app calls your server, your server holds the key, checks the user and their limits, calls the AI provider and streams the answer back. If you don't want to run a server, Firebase AI Logic is a managed alternative.
Adding an AI chat screen to a Flutter app looks like a one-afternoon job. You grab an API key from OpenAI or Google, call the chat endpoint with package:http , and print the reply. It works on your phone, so you ship it.
Then someone pulls the key out of your app and runs their own traffic on your account. You find out from the bill.
This post shows the setup I'd use instead: the key lives on a small server you control, the app talks to that server with the signed-in user's token, and the server handles rate limits, the model choice and the cost caps. The reply still streams into the chat UI word by word.…