Google Gemini API: Setup and Usage
Gemini 1.5 Pro supports up to 1 million token context window. Gemini 1.5 Flash is fast and free for small volumes.
Python SDK
pip install google-generativeaiimport google.generativeai as genai, os
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Explain VPS hosting in 3 sentences.")
print(response.text)Pricing (2025)
| Model | Input | Output |
|---|---|---|
| Flash | $0.075/1M | $0.30/1M |
| Pro | $3.50/1M | $10.50/1M |
Free tier: Flash is free up to 15 RPM — perfect for prototyping and small apps.