Home › Gemini API tutorial for beginners

Gemini API tutorial for beginners

Last checked

Google's current getting-started guide uses the Interactions API: one call with a model name and your input, and the answer comes back as output_text.

Sign up and log in

  1. Sign in to Google AI Studio; it creates a project and an API key for new users automatically.
  2. Copy the key from the API keys page (or select Create API key).
  3. Set it as an environment variable: export GEMINI_API_KEY="YOUR_API_KEY"
  4. Install the Python SDK: pip install -U google-genai (a JavaScript SDK and REST also work).
  5. Optional: select Set up billing to move to the paid tier for higher rate limits.

Step by step

  1. Get your key from the AI Studio API keys page and export GEMINI_API_KEY.
  2. pip install -U google-genai
  3. In Python: from google import genai, then client = genai.Client().
  4. Call client.interactions.create(model="gemini-3.8-flash", input="…").
  5. Print interaction.output_text.

Try it: examples

Good to know

Prices (US$)

The Gemini API has a free tier with limited model access. The paid tier needs Cloud Billing and a minimum prepayment of US$5 in credits. The Batch API costs 50% of the standard price.

Sources (official pages, read Nov 8, 2026)

Written from Google's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.

Report an error on this page