genai.Client() runs, but generate_content says the API key is not valid.
Why this happens
The process may lack access to the environment variable, the key could be invalid or restricted, or the targeted service is disabled in the project options.
Answer 1: Set the environment variable before launching Python
$env:GOOGLE_API_KEY = "your_key_here"
python app.py
from google import genai
client = genai.Client()
