Google Gemini

The google-genai Python library provides convenient access to the Google Gemini API from applications written in the Python language.

To use the Google Gemini API, you first need to have your Google Gemini API key.

Warning

When including private API keys in your code, make sure you DO NOT make your project "Open Source" when you share it.

Examples

from google import genai

api_key = input("🤖 What's your Gemini API Key?\n")
client = genai.Client(api_key=api_key)

question = input("🤖 What's your question?\n")
print("🤖 Please wait a second ...")

response = client.models.generate_content(
    model='gemini-3-flash-preview',
    contents=question,
)
print("🤖", response.text)

Reference