Is the Gemini 2.0 flash API still free to use?

Hello Gemini Developers,

I’ve noticed today that my calls to the Gemini 2.0 Flash API are not succeeding. Could you please let me know if the Gemini 2.0 Flash API is still free to use?

import google.generativeai as genai
import os
API_KEY = ‘MY_key’# ← Replace with your actual API KEY!
if not API_KEY:
print(“Error: API key not found. Please either hardcode your key in the API_KEY variable (not recommended) or set the GOOGLE_API_KEY environment variable.”)
exit()
try:
# Configure Gemini API
genai.configure(api_key=API_KEY)
model = genai.GenerativeModel(‘gemini-2.0-flash’) # Using a recent Flash model, ‘latest’ suffix is often recommended
# Define a simple prompt
prompt = “Please give a simple introduction to artificial intelligence.”
print(f"Calling Gemini API with prompt: ‘{prompt}’“)
# Call API to generate content
response = model.generate_content(prompt)
# Check the response and print the result
if response and response.text:
print(”\nAPI call successful, generated content:“)
print(response.text)
else:
print(”\nAPI call successful, but the model did not return text content.“)
except Exception as e:
print(f”\nAPI call failed: {e}“)
print(”\nTest finished.")

Hi @One_people, I have tried to use Gemini 2.0 flash with free tire api_key and was able to get the response from the model. Please refer to this gist. If possible could you please try to share the error you are getting. Thank You.

Calling Gemini API with prompt: ‘Please give a simple introduction to artificial intelligence.’
API call failed: Timeout of 600.0s exceeded, last exception: 503 failed to connect to all addresses; last error: UNKNOWN: ipv4:142.250.198.74:443: tcp handshaker shutdown
Test finished.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1747120039.364134 3080 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.

Here is the error message. I was able to call this API normally before, but for some reason today, I’m consistently getting a connection timeout. I can confirm that Google AI Studio is working fine for me.

Hi @One_people, Could you please try to increase the timeout time period for the response.

response = model.generate_content(prompt,request_options={'timeout':900})

Thank You.

Hello developer,
I’ve just finished debugging my network, and now I can use the API successfully.
Regarding the gemini-2.0-flash-lite model, could you please confirm if this is the correct way to call it:
model = genai.GenerativeModel(“gemini-2.0-flash-lite”)?