Home › Gemini API tutorial for beginners
Gemini API tutorial for beginners
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
- Sign in to Google AI Studio; it creates a project and an API key for new users automatically.
- Copy the key from the API keys page (or select Create API key).
- Set it as an environment variable: export GEMINI_API_KEY="YOUR_API_KEY"
- Install the Python SDK: pip install -U google-genai (a JavaScript SDK and REST also work).
- Optional: select Set up billing to move to the paid tier for higher rate limits.
Step by step
- Get your key from the AI Studio API keys page and export GEMINI_API_KEY.
- pip install -U google-genai
- In Python: from google import genai, then client = genai.Client().
- Call client.interactions.create(model="gemini-3.8-flash", input="…").
- Print interaction.output_text.
Try it: examples
- First input
Explain in three sentences how a heat pump works.
Good to know
- On the free tier, Google says your content is used to improve its products; the paid tier exists for production apps.
- Watch your usage in AI Studio under Dashboard → Usage.
- Keep the key out of shared code.
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.
New model: Gemini 4 Hydrogen (gemini-4-hydrogen) is on the free API tier; paid $1.50 / $7.50 per 1M tokens.