The caller does not have permission 403 errors for gemini-flash-latest generations

I am getting a random 403 when calling the Google generative api.

I am using gemini-flash-latest.

url: ‘https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-latest:streamGenerateContent?alt=sse’,

Hi @Andrew_Dorobantu ,

Thank you for flagging this issue!
The 403 PERMISSION_DENIED error occurs when your API key doesn’t have the permissions needed to perform this action.
Please check that your API key is set and has the right access. And make sure to go through proper authentication to use tuned models.