You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Gemini API integration fails with new Google AI Studio key format (AQ...) #1253
The app currently fails to authenticate or use the Gemini API when provided with newly generated Google API keys. Google has recently changed their API key format for AI Studio/Google Cloud. New keys now start with **”AQ...”** instead of the legacy **”AIzaSy....”** The app seems to be expecting or validating only the old “AIzaSy...” format, resulting in a failure to connect to the custom server (generativelanguage.googleapis.com).
Steps to reproduce
Go to Google AI Studio and generate a new API key (it will start with AQ...).
Open OpenNutriTracker and go to AI Support settings.
Enter a valid model (e.g., models/gemini-3.1 pro).
Try to use the AI photo recognition feature.
See error (connection fails or unauthorized).
Expected behaviour
The app should successfully authenticate with the Gemini API using the new “ **”AQ...”** key format, as these are now the default and only keys provided by Google to new users.
Actual behaviour
It appears the issue might be in how the app handles or passes the API key in the header for the Gemini endpoint, or possibly a local regex validation that rejects keys not starting with AIza. Updating the authentication handling to support the new format would restore free Gemini API functionality for new users.
Platform
iOS
OS version
IOS 26.6.1
App version
2.2.0
Install source
Apple App Store
Feature area
Other
Screenshots / recordings
Logs or stack trace
Additional context
No response
Checklist
I have searched existing issues and this is not a duplicate
I am reporting a bug in OpenNutriTracker, not a third-party food database entry error
Activity