Ok so the most common thing could be , your AUTH may be outdated . After Google OAuth updates , the gemini API got more stricter about which scopes you request If you were using a broad scope like
https://www.googleapis.com/auth/cloud-platform before, you might now need to be more explicit:
SCOPES = [
"
https://www.googleapis.com/auth/generative-language", # for Gemini API
"
https://www.googleapis.com/auth/generative-language.tuning" # if you're fine-tuning
]
And if you’re using REST API directly then :
import google.auth
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file(
"service_account.json",
scopes=["
https://www.googleapis.com/auth/generative-language"]
)