This error occurs when your Google API key has HTTP referrer restrictions that don't allow requests from localhost. Here's exactly how to fix it:
Navigate to: https://console.cloud.google.com/apis/credentials
Make sure you're signed in with the same account that created the API key.
Look for your API key in the list. It should end with ...P9pJEE
Click the EDIT button (pencil icon) next to your API key.
Scroll down to the "Application restrictions" section.
You'll see it's currently set to "HTTP referrers" with some restrictions.
Change the restriction type from "HTTP referrers" to "None"
This removes all restrictions and allows the API key to work from anywhere.
Keep "HTTP referrers" and add these entries:
Click the "SAVE" button at the bottom of the page.
Google needs 2-3 minutes to apply the changes.
Go to: http://localhost:8000/check_api_key.php
This will test if your API key restrictions are now fixed.
Once the test passes, try your AI mode:
Upload an image and it should work!
If you still get errors, try these diagnostic tools:
Need help? The diagnostic tools will give you specific error codes and solutions.