All insights

Model APIs

Gemini 3.1 API: Google-Native Setup, Models, and Production Status

Compare Gemini 3.1 Pro Preview and stable Flash-Lite, then make a first Google-native Gemini API request with Python.

Illustration for Gemini 3.1 api

The short answer

For a Google-native Gemini API integration, Google lists Gemini 3.1 Pro Preview (gemini-3.1-pro-preview) and Gemini 3.1 Flash-Lite (gemini-3.1-flash-lite). Pro is listed as Preview; Flash-Lite is listed as Stable. If your release policy rules out Preview models, Flash-Lite is the clearer Gemini 3.1 option in Google’s current Developer API catalog. A Stable listing is a lifecycle status, not a guarantee that the model meets your application’s reliability, latency, or compliance requirements. (Pro model page)

The Python example below uses Google’s Gemini Developer API and Google GenAI SDK—not a third-party router. It follows Google’s Flash-Lite model-page example. (Flash-Lite model page)

Choose the model and API route

Model Google Developer API listing Consider it when
Gemini 3.1 Pro Preview (gemini-3.1-pro-preview) Preview; 1,048,576-token input limit and 65,536-token output limit. Inputs: text, image, video, audio, and PDF; output: text. Complex reasoning, software engineering, or agentic workflows matter and Preview status is acceptable.
Gemini 3.1 Flash-Lite (gemini-3.1-flash-lite) Stable; 1,048,576-token input limit and 65,536-token output limit. Inputs: text, image, video, audio, and PDF; output: text. You want a Stable listing and your workload fits Google’s positioning for lightweight, high-frequency tasks where latency and API cost matter.

Google lists both models as supporting function calling, search grounding, and structured outputs. These are model-page support listings, not complete configuration instructions. (Pro model page; Flash-Lite model page)

These listings describe the Gemini Developer API. Google Cloud’s Gemini Enterprise Agent Platform and Vertex AI are separate integration routes; don’t assume their setup, endpoints, authentication, or terms are identical. For example, Google’s Agent Platform guide specifies API-key or ADC authentication and describes a global-endpoint requirement for its named Pro preview model. (Google Cloud Agent Platform guide)

Make a first Google-native API request with Python

You’ll need: Python, a Gemini API key, and Google’s google-genai package. Google AI Studio can create a project and API key for new users. The Gemini API and AI Studio are available only in listed countries and territories, so check Google’s current region information if access is an issue. (Google AI Studio getting started)

Google’s billing documentation says the Free Tier covers certain models, but the retrieved billing guidance does not confirm whether this specific Flash-Lite request is eligible. Check the current model’s pricing entry before assuming the request is free. Moving a project to the Paid Tier requires linking billing; Google’s current guide says the setup includes a minimum $5 prepayment in credits. (Gemini API billing)

  1. Install the SDK:

    pip install -U google-genai
    
  2. Set your API key in the environment. Keep it in a trusted server or local development environment; don’t expose it in browser-side code.

    export GEMINI_API_KEY="YOUR_API_KEY"
    
  3. Save as first_request.py and run python first_request.py:

    from google import genai
    
    client = genai.Client()
    response = client.models.generate_content(
        model="gemini-3.1-flash-lite",
        contents="Explain what an API is in one sentence.",
    )
    
    print(response.text)
    

Google’s quickstart documents the GEMINI_API_KEY environment variable and genai.Client() initialization. Its Flash-Lite model page shows the generate_content call, model ID, and response.text access pattern. (Google AI Studio getting started)

Check feature fit before deploying

For both models, Google’s model pages list support for function calling, search grounding, and structured outputs. These listings are not complete configuration instructions; consult the relevant feature documentation for anything your application depends on. (Pro model page; Flash-Lite model page)

Google positions Flash-Lite for low-latency, high-frequency, lightweight work. That is product guidance, not a performance guarantee for your workload. Test representative requests and check the current model pricing and project usage limits before estimating operating cost. (Flash-Lite model page)

Keep Google’s API distinct from third-party routers

Some providers offer OpenAI-compatible access to Gemini through their own services. Their hostnames, credentials, model identifiers, prices, and terms belong to those providers; they are not Google-native Gemini API instructions. For a direct Google integration, use Google’s API-key guidance and Google GenAI SDK or the relevant Google API reference. (Google AI Studio getting started)

Practical choice: start with Flash-Lite when its Stable listing and lightweight-task positioning suit your use case. Evaluate Pro when its complex-reasoning focus fits and Preview status is acceptable. For either model, check current availability, project access, limits, and pricing before release.

Sources

Gemini 3.1 Pro preview | Gemini API | Google AI for Developers

Gemini 3.1 Flash-Lite | Gemini API | Google AI for Developers

Gemini 3.1 Flash-Lite | Gemini API | Google AI Studio

Getting started | Gemini API | Google AI Studio

Billing | Gemini API | Google AI for Developers

Available regions for Google AI Studio and Gemini API

Get started with Gemini 3 | Gemini Enterprise Agent Platform

Contact us