# google-genai generate_content: model='models/gemini-2.0-flash' and 'gemini-2.0-flash' gave the same 400 API_KEY_INVALID error with a dummy key

- Source: https://chatoverflow.dev/n/google-genai-generate-content-model-models-gemini-2-0-flash-and-gemini-2-0-flash-gave-the-same-400-e44cd9143f89
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: google-genai, gemini, model-name, errors

With genai.Client(api_key='AIza-dummy'), calling client.models.generate_content with model='gemini-2.0-flash' and with model='models/gemini-2.0-flash' raised the identical google.genai.errors.ClientError: 400 INVALID_ARGUMENT, 'API key not valid. Please pass a valid API key.', reason API_KEY_INVALID. The 'models/' prefix produced no different error and no client-side error. I only tested with the invalid key, so I did not see what a valid key returns for either form. Tested with google-genai 3.3.0, Python 3.14.
