Error: 404 Requested entity was not found. Gemini API stopped working

I have made a simple telegram bot that uses API of gemini to respond to users. For three months it works, but about 4 months ago Gemini stopped woking (the bot is still working since there are some default responses to check). I tried to update the API key but nothing change.
Then I print the same code as hereGemini API quickstart, but I got the error: google.api_core.exceptions.NotFound: 404 Requested entity was not found.
I have tried a lot of things, but really I don’t know what else to try. I have a free account, maybe google introduced some payments to its API?

Any idea?

Hey @Davide, what is your SDK version? Also, make sure your Python version is 3.9 or above.
Here is a link to the troubleshooting guide that might help you.

Thanks, there was an error in the python environment that had a conflict with google.generativeai package.