> ## AI Agent Context > Get the complete documentation index at: https://aistudio.google.com/docs/llms.txt > Use this file to discover all available pages. > For the full documentation in a single file, fetch: https://aistudio.google.com/docs/llms-full.txt # Gemini API {% two-column-layout %} {% left-column %} The Gemini API is the fastest path from prompt to production with Gemini, Veo, Nano Banana, and more. It lets you integrate these generative models into your applications to generate text and images, analyze multimodal inputs, and build conversational agents. {% button href="/docs/get-started" variant="primary" %} Get Started {% /button %} {% button href="https://aistudio.google.com/apikey" variant="ais" %} Create API Key {% /button %} {% /left-column %} {% right-column %} {% tabs %} {% tab filename="main.py" label="Python" %} ```python from google import genai client = genai.Client() interaction = client.interactions.create( model="gemini-4-argon", input="Explain how AI works in a few words" ) print(interaction.output_text) ``` {% /tab %} {% tab filename="index.js" label="JavaScript" %} ```javascript import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({}); const interaction = await ai.interactions.create({ model: "gemini-4-argon", input: "Explain how AI works in a few words", }); console.log(interaction.output_text); ``` {% /tab %} {% tab label="REST" %} ```bash curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model": "gemini-4-argon", "input": "Explain how AI works in a few words" }' ``` {% /tab %} {% tab label="Java" %} ```java import com.google.genai.Client; import com.google.genai.gaos.models.interactions.CreateModelInteraction; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.interactions.InteractionsInput; import com.google.genai.gaos.models.interactions.Model; import com.google.genai.gaos.models.operations.CreateInteractionRequestBody; Client client = new Client(); CreateModelInteraction params = CreateModelInteraction.builder() .model(Model.of("gemini-4-argon")) .input(InteractionsInput.of("Explain how AI works in a few words")) .build(); Interaction interaction = client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get(); System.out.println(interaction.outputText().orElse("")); ``` {% /tab %} {% tab label="Go" %} ```go package main import ( "context" "fmt" "log" "google.golang.org/genai" "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) } res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{ Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{ Model: interactions.Model("gemini-4-argon"), Input: interactions.NewInteractionsInput("Explain how AI works in a few words"), }), }) if err != nil { log.Fatal(err) } if res.Interaction.OutputText != nil { fmt.Println(*res.Interaction.OutputText) } } ``` {% /tab %} {% /tabs %} {% /right-column %} {% /two-column-layout %} ## Meet the models {% class="hide-from-toc" id="meet-the-models" %} [View all](/docs/models) {% card-grid %} {% card badge="New" description="Our flagship reasoning model with a shared 1M context window and long decodes up to 1M tokens." href="/docs/models/gemini-4-argon" icon="auto_awesome" title="Gemini 4 Argon" /%} {% card badge="New" description="Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows." href="/docs/models/gemini-3.8-flash" icon="spark" title="Gemini 3.8 Flash" /%} {% card badge="New" description="Default Live API model for most low-latency voice agent experiences\nwithout reasoning delays." href="/docs/models/gemini-3.8-live" icon="settings_voice" title="Gemini 3.8 Live" /%} {% card badge="New" description="Studio-grade text-to-speech model with expressive acting, custom Voice design, and Voice replication." href="/docs/models/gemini-3.8-flash-tts" icon="graphic_eq" title="Gemini 3.8 Flash TTS" /%} {% card description="High-volume, cost-sensitive model optimized for low-latency high throughput subagent tasks." href="/docs/models/gemini-3.5-flash-lite" icon="spark" title="Gemini 3.5 Flash-Lite" /%} {% card description="State-of-the-art image generation and editing models." href="/docs/image-generation" title="🍌 Nano Banana" /%} {% card description="Our state-of-the-art video generation and editing model." href="/docs/omni" icon="video_library" title="Gemini Omni Flash" /%} {% card badge="New" description="Low-latency speech-to-text model with utterance-based language detection, speaker diarization, and word timestamps." href="/docs/models/gemini-3.5-transcribe" icon="speech_to_text" title="Gemini 3.5 Transcribe" /%} {% card description=A vision-language model (VLM) that brings Gemini's agentic capabilities to robotics and enables advanced reasoning in the physical world. href="/docs/robotics-overview" icon="spark" title="Gemini Robotics" /%} {% /card-grid %} ## Explore Capabilities {% class="hide-from-toc" id="explore-capabilities" %} {% card-grid %} {% card description="Generate and edit highly contextual images natively with Nano Banana." href="/docs/image-generation" icon="imagesmode" title="Image Generation" /%} {% card description="Input\nmillions of tokens to Gemini models and derive understanding from unstructured\nimages, videos, and documents." href="/docs/long-context" icon="article" title="Long Context" /%} {% card description="Constrain Gemini to respond with JSON, a structured data format\nsuitable for automated processing." href="/docs/structured-output" icon="code" title="Structured Outputs" /%} {% card description="Build agentic workflows by connecting Gemini to external APIs and\ntools." href="/docs/function-calling" icon="functions" title="Function Calling" /%} {% card description="Create high-quality video content from text or image prompts with\nour state-of-the-art model." href="/docs/video" icon="videocam" title="Video Generation with Veo 3.1" /%} {% card description="Build real-time voice applications and agents with the Live API." href="/docs/live-api" icon="android_recorder" title="Voice Agents with Live API" /%} {% card description="Connect Gemini to the\nworld through built-in tools like Google Search, URL Context, Google Maps, Code\nExecution and Computer Use." href="/docs/tools" icon="build" title="Tools" /%} {% card description="Process up to 1000 pages of PDF files with full multimodal\nunderstanding or other text-based file types." href="/docs/document-processing" icon="stacks" title="Document Understanding" /%} {% card description="Explore how thinking\ncapabilities improve reasoning for complex tasks and agents." href="/docs/thinking" icon="cognition_2" title="Thinking" /%} {% /card-grid %} ## Create agents {% class="hide-from-toc" id="create-agents" %} {% two-column-layout %} {% left-column %} Managed Agents give Gemini a workspace to plan and complete tasks on its own. In a single request, Gemini can write and run code, search the web, and create files in a hosted sandbox environment. Start with our prebuilt Antigravity agent, or customize it with your own instructions and tools. {% button href="/docs/managed-agents-quickstart" variant="primary" %} Agents quickstart {% /button %} {% button href="https://aistudio.google.com/prompts/new_chat?model=antigravity-preview-09-2026" variant="ais" %} Try in AI Studio {% /button %} {% /left-column %} {% right-column %} {% tabs %} {% tab filename="agent.py" label="Python" %} ```python from google import genai client = genai.Client() interaction = client.interactions.create( agent="antigravity-preview-09-2026", input=( "Research the top 5 sustainable fashion brands, " "compare their materials and pricing tiers, and " "build an interactive dashboard in analysis.html." ), environment="remote" ) print(interaction.output_text) ``` {% /tab %} {% tab filename="agent.js" label="JavaScript" %} ```javascript import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({}); const interaction = await ai.interactions.create({ agent: "antigravity-preview-09-2026", input: "Research the top 5 sustainable fashion brands, " + "compare their materials and pricing tiers, and " + "build an interactive dashboard in analysis.html.", environment: "remote", }); console.log(interaction.output_text); ``` {% /tab %} {% tab filename="agent.sh" label="REST" %} ```bash curl -X POST \ "https://generativelanguage.googleapis.com/v1beta/interactions" \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "agent": "antigravity-preview-09-2026", "input": "Research the top 5 sustainable fashion brands, compare their materials and pricing tiers, and build an interactive dashboard in analysis.html.", "environment": "remote" }' ``` {% /tab %} {% tab filename="AgentQuickstart.java" label="Java" %} ```java import com.google.genai.Client; import com.google.genai.gaos.models.interactions.AgentOption; import com.google.genai.gaos.models.interactions.CreateAgentInteraction; import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.interactions.InteractionsInput; import com.google.genai.gaos.models.operations.CreateInteractionRequestBody; Client client = new Client(); CreateAgentInteraction params = CreateAgentInteraction.builder() .agent(AgentOption.of("antigravity-preview-09-2026")) .input( InteractionsInput.of( "Research the top 5 sustainable fashion brands, " + "compare their materials and pricing tiers, and " + "build an interactive dashboard in analysis.html.")) .environment(CreateAgentInteractionEnvironment.of("remote")) .build(); Interaction interaction = client.interactions.create(CreateInteractionRequestBody.of(params)) .interaction() .get(); System.out.println(interaction.outputText().orElse("")); ``` {% /tab %} {% tab label="Go" %} ```go package main import ( "context" "fmt" "log" "google.golang.org/genai" "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" ) func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) } res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{ Body: operations.NewCreateInteractionRequestBody(interactions.CreateAgentInteraction{ Agent: interactions.AgentOption("antigravity-preview-09-2026"), Input: interactions.NewInteractionsInput( "Research the top 5 sustainable fashion brands, " + "compare their materials and pricing tiers, and " + "build an interactive dashboard in analysis.html.", ), Environment: genai.Ptr(interactions.NewCreateAgentInteractionEnvironment("remote")), }), }) if err != nil { log.Fatal(err) } if res.Interaction.OutputText != nil { fmt.Println(*res.Interaction.OutputText) } } ``` {% /tab %} {% /tabs %} {% /right-column %} {% /two-column-layout %} ## Interactions API {% class="hide-from-toc" id="interactions-api" %} The **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. {% card-grid %} {% card description="Learn how the Interactions API manages conversation state, messages, and output formats." href="/docs/interactions-overview" icon="hub" title="Interactions Overview" /%} {% card description="Step-by-step guide to transition your code from generateContent to the Interactions API." href="/docs/migrate-to-interactions" icon="swap_horiz" title="Migration Guide" /%} {% card description="Stream real-time tokens, incremental thoughts, and tool call events." href="/docs/streaming" icon="stream" title="Streaming" /%} {% /card-grid %}