Repository Public
1The Gemini API is the fastest path from prompt to production with Gemini, Veo,2Nano Banana, and more. It lets you integrate these generative models into your3applications to generate text and images, analyze multimodal inputs, and build4conversational agents.56### Python78 from google import genai910 client = genai.Client()1112 interaction = client.interactions.create(13 model="gemini-3.8-flash",14 input="Explain how AI works in a few words"15 )1617 print(interaction.output_text)1819### JavaScript2021 import { GoogleGenAI } from "@google/genai";2223 const ai = new GoogleGenAI({});2425 const interaction = await ai.interactions.create({26 model: "gemini-3.8-flash",27 input: "Explain how AI works in a few words",28 });2930 console.log(interaction.output_text);3132### Java3334 import com.google.genai.Client;35 import com.google.genai.gaos.models.interactions.CreateModelInteraction;36 import com.google.genai.gaos.models.interactions.Interaction;37 import com.google.genai.gaos.models.interactions.InteractionsInput;38 import com.google.genai.gaos.models.interactions.Model;39 import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;4041 Client client = new Client();4243 CreateModelInteraction params =44 CreateModelInteraction.builder()45 .model(Model.of("gemini-3.7-flash"))46 .input(InteractionsInput.of("Explain how AI works in a few words"))47 .build();4849 Interaction interaction =50 client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();5152 System.out.println(interaction.outputText().orElse(""));5354### REST5556 curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \57 -H "x-goog-api-key: $GEMINI_API_KEY" \58 -H 'Content-Type: application/json' \59 -d '{60 "model": "gemini-3.8-flash",61 "input": "Explain how AI works in a few words"62 }'6364[Get Started](https://ai.google.dev/gemini-api/docs/get-started) [Create API Key](https://aistudio.google.com/apikey)6566*** ** * ** ***6768## Meet the models6970[View all](https://ai.google.dev/gemini-api/docs/models) [Gemini 3.8 Flash71New72Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows.](https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash) [Gemini 3.5 Flash-Lite73High-volume, cost-sensitive model optimized for low-latency high throughput subagent tasks.](https://ai.google.dev/gemini-api/docs/models/gemini-3.5-flash-lite) [Gemini 3.1 Pro74Our most intelligent model, the best in the world for multimodal understanding, all built on state-of-the-art reasoning.](https://ai.google.dev/gemini-api/docs/models/gemini-3.1-pro-preview) [Nano Banana 2 and Nano Banana Pro75State-of-the-art image generation and editing models.](https://ai.google.dev/gemini-api/docs/image-generation) [Gemini Omni Flash76Our state-of-the-art video generation and editing model.](https://ai.google.dev/gemini-api/docs/omni) [Gemini 3.5 Transcribe77New78Low-latency speech-to-text model with utterance-based language detection, speaker diarization, and word timestamps.](https://ai.google.dev/gemini-api/docs/models/gemini-3.5-transcribe) [Gemini Robotics79A vision-language model (VLM) that brings Gemini's agentic capabilities to robotics and enables advanced reasoning in the physical world.](https://ai.google.dev/gemini-api/docs/robotics-overview)8081## Explore Capabilities8283[Image Generation84Generate and edit highly contextual images natively with Nano Banana.](https://ai.google.dev/gemini-api/docs/image-generation) [Long Context85Input millions of tokens to Gemini models and derive understanding from unstructured images, videos, and documents.](https://ai.google.dev/gemini-api/docs/long-context) [Structured Outputs86Constrain Gemini to respond with JSON, a structured data format suitable for automated processing.](https://ai.google.dev/gemini-api/docs/structured-output) [Function Calling87Build agentic workflows by connecting Gemini to external APIs and tools.](https://ai.google.dev/gemini-api/docs/function-calling) [Video Generation with Veo 3.188Create high-quality video content from text or image prompts with our state-of-the-art model.](https://ai.google.dev/gemini-api/docs/video) [Voice Agents with Live API89Build real-time voice applications and agents with the Live API.](https://ai.google.dev/gemini-api/docs/live) [Tools90Connect Gemini to the world through built-in tools like Google Search, URL Context, Google Maps, Code Execution and Computer Use.](https://ai.google.dev/gemini-api/docs/tools) [Document Understanding91Process up to 1000 pages of PDF files with full multimodal understanding or other text-based file types.](https://ai.google.dev/gemini-api/docs/document-processing) [Thinking92Explore how thinking capabilities improve reasoning for complex tasks and agents.](https://ai.google.dev/gemini-api/docs/thinking)9394## Create agents9596Managed Agents give Gemini a workspace to plan and complete tasks on its own. In97a single request, Gemini can write and run code, search the web, and create98files in a hosted sandbox environment. Start with our prebuilt Antigravity99agent, or customize it with your own instructions and tools.100101### Python102103 from google import genai104105 client = genai.Client()106107 interaction = client.interactions.create(108 agent="antigravity-preview-09-2026",109 input=(110 "Research the top 5 sustainable fashion brands, "111 "compare their materials and pricing tiers, and "112 "build an interactive dashboard in analysis.html."113 ),114 environment="remote"115 )116117 print(interaction.output_text)118119### JavaScript120121 import { GoogleGenAI } from "@google/genai";122123 const ai = new GoogleGenAI({});124125 const interaction = await ai.interactions.create({126 agent: "antigravity-preview-09-2026",127 input:128 "Research the top 5 sustainable fashion brands, " +129 "compare their materials and pricing tiers, and " +130 "build an interactive dashboard in analysis.html.",131 environment: "remote",132 });133134 console.log(interaction.output_text);135136### Java137138 import com.google.genai.Client;139 import com.google.genai.gaos.models.interactions.AgentOption;140 import com.google.genai.gaos.models.interactions.CreateAgentInteraction;141 import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;142 import com.google.genai.gaos.models.interactions.Interaction;143 import com.google.genai.gaos.models.interactions.InteractionsInput;144 import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;145146 Client client = new Client();147148 CreateAgentInteraction params =149 CreateAgentInteraction.builder()150 .agent(AgentOption.of("antigravity-preview-09-2026"))151 .input(152 InteractionsInput.of(153 "Research the top 5 sustainable fashion brands, "154 + "compare their materials and pricing tiers, and "155 + "build an interactive dashboard in analysis.html."))156 .environment(CreateAgentInteractionEnvironment.of("remote"))157 .build();158159 Interaction interaction =160 client.interactions.create(CreateInteractionRequestBody.of(params))161 .interaction()162 .get();163164 System.out.println(interaction.outputText().orElse(""));165166### REST167168 curl -X POST \169 "https://generativelanguage.googleapis.com/v1beta/interactions" \170 -H "x-goog-api-key: $GEMINI_API_KEY" \171 -H 'Content-Type: application/json' \172 -d '{173 "agent": "antigravity-preview-09-2026",174 "input": "Research the top 5 sustainable fashion brands, compare their materials and pricing tiers, and build an interactive dashboard in analysis.html.",175 "environment": "remote"176 }'177178[Agents quickstart](https://ai.google.dev/gemini-api/docs/managed-agents-quickstart) [Try in AI Studio](https://aistudio.google.com/prompts/new_chat?model=antigravity-preview-09-2026)179180## Interactions API181182The **Interactions API** has become our default interface as of June 2026 and is the best way to build with Gemini models and agents going forward. If you're starting a new project, you should use the Interactions API. While it remains supported, the `generateContent` API is now considered legacy.183[Interactions Overview184Learn how the Interactions API manages conversation state, messages, and output formats.](https://ai.google.dev/gemini-api/docs/interactions-overview) [Migration Guide185Step-by-step guide to transition your code from generateContent to the Interactions API.](https://ai.google.dev/gemini-api/docs/migrate-to-interactions) [Streaming186Stream real-time tokens, incremental thoughts, and tool call events.](https://ai.google.dev/gemini-api/docs/streaming) [Google AI Studio187Test prompts, manage your API keys, monitor usage, and build prototypes.](https://aistudio.google.com) [Developer Community188Ask questions and find solutions from other developers and Google engineers.](https://discuss.ai.google.dev/c/gemini-api/4) [API Reference189Find detailed information about the Gemini API in the official reference documentation.](https://ai.google.dev/api) [Status190Check the status of Gemini API, Google AI Studio, and our model services.](https://aistudio.google.com/status)