Quickstart Guide

Get started with Gemini 3 in just a few minutes

1

Get Your API Key

  1. Visit Google AI Studio (https://ai.google.dev/?hl=en)
  2. Sign in with your Google account
  3. Navigate to API keys section
  4. Create a new API key
  5. Save it securely - you'll need it for all API calls
2

Choose Your Model

gemini-3-pro-image-preview

Best for professional assets, supports up to 4K resolution, Google Search grounding, and advanced reasoning

gemini-2.5-flash-image

Optimized for speed, perfect for prototyping and quick iterations

3

Run Your First Text-to-Image Request

Run Your First Text-to-Image Request

from google import genai
from PIL import Image

client = genai.Client()

prompt = "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"

response = client.models.generate_content(
    model="gemini-2.5-flash-image",
    contents=[prompt],
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif part.inline_data is not None:
        image = part.as_image()
        image.save("generated_image.png")

Next Steps