> ## AI Agent Context
> Get the complete documentation index at: https://aistudio.google.com/llms.txt
> Use this file to discover all available pages.
> For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt

{% two-column-layout %}
  {% left-column %}
# Welcome to Gemini API  {% class="h0" %}

  Go from a quick prompt to production apps and agents with the Gemini API.
    Tackle complex coding and multimodal reasoning with Gemini, or hand multi-step
    work to a managed agent. Stream voice and video with the Live API, or generate
    images with Nano Banana, video with Gemini Omni, and music with Lyria.

  {% button href="/docs/get-started" size="large" variant="ais" %}Get Started{% /button %} {% button href="https://aistudio.google.com/apikey" size="large" variant="primary" %}Create API Key{% /button %}

  {% /left-column %}

  {% right-column %}
  {% tabs %}
  {% tab label="Agents" %}
  ```bash
  # Set up your coding agent with these tools
  
  # Search live docs with the MCP server
  npx add-mcp "https://gemini-api-docs-mcp.dev"
  
  # Add skills for current SDK syntax and rules
  npx skills add google-gemini/gemini-skills --skill gemini-api-dev
  
  # In Antigravity, install both with one plugin
  agy plugin install https://github.com/google-gemini/gemini-skills
  
  # Let your agent call the API from the terminal
  curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
  ```

  {% /tab %}

  {% tab filename="main.py" label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-4-carbon",
      contents="Explain how AI works in a few words",
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab filename="index.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  async function main() {
    const response = await ai.models.generateContent({
      model: "gemini-4-carbon",
      contents: "Explain how AI works in a few words",
    });
    console.log(response.text);
  }
  
  await main();
  ```

  {% /tab %}

  {% tab filename="main.go" label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
  )
  
  func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
  
      result, err := client.Models.GenerateContent(
          ctx,
          "gemini-4-carbon",
          genai.Text("Explain how AI works in a few words"),
          nil,
      )
      if err != nil {
          log.Fatal(err)
      }
      fmt.Println(result.Text())
  }
  ```

  {% /tab %}

  {% tab filename="GenerateTextFromTextInput.java" label="Java" %}
  ```java
  package com.example;
  
  import com.google.genai.Client;
  import com.google.genai.types.GenerateContentResponse;
  
  public class GenerateTextFromTextInput {
    public static void main(String[] args) {
      Client client = new Client();
  
      GenerateContentResponse response =
          client.models.generateContent(
              "gemini-4-carbon",
              "Explain how AI works in a few words",
              null);
  
      System.out.println(response.text());
    }
  }
  ```

  {% /tab %}

  {% tab filename="GenerateContentSimpleText.cs" label="C#" %}
  ```csharp
  using System.Threading.Tasks;
  using Google.GenAI;
  using Google.GenAI.Types;
  
  public class GenerateContentSimpleText {
    public static async Task main() {
      var client = new Client();
      var response = await client.Models.GenerateContentAsync(
        model: "gemini-4-carbon", contents: "Explain how AI works in a few words"
      );
      Console.WriteLine(response.Candidates[0].Content.Parts[0].Text);
    }
  }
  ```

  {% /tab %}

  {% tab label="REST" %}
  ```bash
  curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-4-carbon:generateContent" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [
        {
          "parts": [
            {
              "text": "Explain how AI works in a few words"
            }
          ]
        }
      ]
    }'
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

## Meet the models  {% class="hide-from-toc" id="meet-the-models" %}

{% card-grid columns="3" %}
  {% card description="Our most capable reasoning model with a shared 1M context window and long decodes up to 1M tokens." title="Gemini 4 Carbon" variant="model-card" %}
  {% section class="model-specs" %}
  *   *Model code* **gemini-4-carbon**
  *   *Context* **1M tokens**
  *   *Max output* **65K / 1M tokens**
  *   *Modalities* **Text, Image, Audio, Video, PDF**

  {% /section %}

  {% section class="card-actions" %}
  {% button href="https://aistudio.google.com/prompts/new_chat?model=gemini-4-carbon" variant="primary" %}Try in AI Studio{% /button %} {% button href="/docs/models/gemini-4-carbon" icon="arrow_forward" tooltip="View models" variant="icon-primary" /%}

  {% /section %}

  {% /card %}

  {% card description="Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows." title="Gemini 3.8 Flash" variant="model-card" %}
  {% section class="model-specs" %}
  *   *Model code* **gemini-3.8-flash**
  *   *Context* **1M tokens**
  *   *Max output* **65K tokens**
  *   *Modalities* **Text, Image, Audio, Video, PDF**

  {% /section %}

  {% section class="card-actions" %}
  {% button href="https://aistudio.google.com/prompts/new_chat?model=gemini-3.8-flash" variant="primary" %}Try in AI Studio{% /button %} {% button href="/docs/models/gemini-3.8-flash" icon="arrow_forward" tooltip="View models" variant="icon-primary" /%}

  {% /section %}

  {% /card %}

  {% card description="Default Live API model for low-latency, bidirectional voice and video agent experiences without reasoning delays." title="Gemini 3.8 Live" variant="model-card" %}
  {% section class="model-specs" %}
  *   *Model code* **gemini-3.8-live**
  *   *Context* **128K tokens**
  *   *Max output* **8K tokens**
  *   *Modalities* **Audio, Video, Text → Audio, Text**

  {% /section %}

  {% section class="card-actions" %}
  {% button href="https://aistudio.google.com/live" variant="primary" %}Try in AI Studio{% /button %} {% button href="/docs/models/gemini-3.8-live" icon="arrow_forward" tooltip="View models" variant="icon-primary" /%}

  {% /section %}

  {% /card %}

  {% card description="Flagship creative text-to-speech model for studio-grade voice fidelity, expressive acting, Voice design, and Voice replication." title="Gemini 3.8 Flash TTS" variant="model-card" %}
  {% section class="model-specs" %}
  *   *Model code* **gemini-3.8-flash-tts**
  *   *Context* **8K tokens**
  *   *Max output* **16K tokens**
  *   *Modalities* **Text → Audio**

  {% /section %}

  {% section class="card-actions" %}
  {% button href="https://aistudio.google.com/prompts/new_chat?model=gemini-3.8-flash-tts" variant="primary" %}Try in AI Studio{% /button %} {% button href="/docs/models/gemini-3.8-flash-tts" icon="arrow_forward" tooltip="View models" variant="icon-primary" /%}

  {% /section %}

  {% /card %}

  {% card description="State-of-the-art image generation and editing model for studio-quality precision, accurate text rendering, and complex visual creation." title="Nano Banana Pro" variant="model-card" %}
  {% section class="model-specs" %}
  *   *Model code* **gemini-3-pro-image**
  *   *Context* **65K tokens**
  *   *Max output* **32K tokens**
  *   *Modalities* **Text, Image → Image, Text**

  {% /section %}

  {% section class="card-actions" %}
  {% button href="https://aistudio.google.com/prompts/new_chat?model=gemini-3-pro-image" variant="primary" %}Try in AI Studio{% /button %} {% button href="/docs/models/gemini-3-pro-image" icon="arrow_forward" tooltip="View models" variant="icon-primary" /%}

  {% /section %}

  {% /card %}

  {% card href="/docs/models" title="View all models" variant="view-more" /%}

{% /card-grid %}

## Explore Capabilities  {% class="hide-from-toc" id="explore-capabilities" %}

{% tabs variant="showcase" %}
  {% tab label="Image" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="image_gen.py" label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client(http_options={"api_version": "v1beta"})
  
  response = client.models.generate_content(
      model="gemini-3.1-flash-image-preview",
      contents=["Generate an image of a nano banana dish in a fancy restaurant"],
      config=types.GenerateContentConfig(
          response_modalities=["TEXT", "IMAGE"],
          image_config=types.ImageConfig(aspect_ratio="16:9", image_size="2K"),
      ),
  )
  
  for part in response.parts:
      if part.inline_data is not None:
          image = part.as_image()
          image.save("nano_banana.png")
  ```

  {% /tab %}

  {% tab filename="image_gen.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  import * as fs from "node:fs";
  
  const ai = new GoogleGenAI({ httpOptions: { apiVersion: "v1beta" } });
  
  const response = await ai.models.generateContent({
    model: "gemini-3.1-flash-image-preview",
    contents: "Generate an image of a nano banana dish in a fancy restaurant",
    config: {
      responseModalities: ["TEXT", "IMAGE"],
      imageConfig: { aspectRatio: "16:9", imageSize: "2K" },
    },
  });
  
  for (const part of response.candidates[0].content.parts) {
    if (part.inlineData) {
      fs.writeFileSync(
        "nano_banana.png",
        Buffer.from(part.inlineData.data, "base64")
      );
    }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Image generation

  Generate and edit highly contextual images natively with Nano Banana models
        using text, image, or interleaved multimodal prompts.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Up to 4K resolution** with flexible aspect ratios
  *   {% icon name="check" /%} **Multi-turn editing** and character consistency
  *   {% icon name="check" /%} **Search-grounded** visual accuracy and text
            rendering

  {% /section %}

  {% button href="/docs/image-generation" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Video" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="video_gen.py" label="Python" %}
  ```python
  import base64
  from google import genai
  
  client = genai.Client()
  
  interaction = client.interactions.create(
      model="gemini-omni-1.2-flash",
      input="A cinematic close-up of two people talking by a window in the rain",
  )
  
  with open("dialogue_example.mp4", "wb") as f:
      f.write(base64.b64decode(interaction.output_video.data))
  ```

  {% /tab %}

  {% tab filename="video_gen.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  import * as fs from "node:fs";
  
  const ai = new GoogleGenAI({});
  
  const interaction = await ai.interactions.create({
    model: "gemini-omni-1.2-flash",
    input: "A cinematic close-up of two people talking by a window in the rain",
  });
  
  if (interaction.output_video?.data) {
    fs.writeFileSync(
      "dialogue_example.mp4",
      Buffer.from(interaction.output_video.data, "base64")
    );
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Video generation

  Create high-definition video with natively synchronized dialogue, sound effects,
        and ambient audio from text or image prompts.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Native audio & dialogue** synchronized to motion
  *   {% icon name="check" /%} **Frame interpolation** with first and last frame
            control
  *   {% icon name="check" /%} **Reference images** to preserve character and
            style

  {% /section %}

  {% button href="/docs/video" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Voice" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="live_agent.py" label="Python" %}
  ```python
  import asyncio
  from google import genai
  from google.genai import types
  
  client = genai.Client(http_options={"api_version": "v1beta"})
  
  async def main():
      config = types.LiveConnectConfig(response_modalities=["AUDIO"])
      async with client.aio.live.connect(
          model="gemini-3.8-live-preview", config=config
      ) as session:
          await session.send_client_content(
              turns={"parts": [{"text": "Hello! Tell me a quick fun fact."}]}
          )
          async for response in session.receive():
              if response.data is not None:
                  # Stream raw PCM audio bytes to speaker
                  pass
  
  asyncio.run(main())
  ```

  {% /tab %}

  {% tab filename="live_agent.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI, Modality } from "@google/genai";
  
  const ai = new GoogleGenAI({ httpOptions: { apiVersion: "v1beta" } });
  
  const session = await ai.live.connect({
    model: "gemini-3.8-live-preview",
    config: { responseModalities: [Modality.AUDIO] },
    callbacks: {
      onmessage: (message) => {
        if (message.serverContent?.modelTurn) {
          // Handle low-latency streaming audio chunks
        }
      },
    },
  });
  
  session.sendClientContent({
    turns: [{ parts: [{ text: "Hello! Tell me a quick fun fact." }] }],
  });
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Voice agents with Live API

  Build real-time, bidirectional voice and video agents with sub-second latency,
        natural barge-in, and live tool calling.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Real-time WebSocket streaming** for audio and
            video
  *   {% icon name="check" /%} **Natural voice activity detection** and
            interruption handling
  *   {% icon name="check" /%} **Expressive multilingual voices** with affective
            dialogue

  {% /section %}

  {% button href="/docs/live-api" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Thinking" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="thinking.py" label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents="Find the flaw in this distributed lock protocol and fix it.",
      config=types.GenerateContentConfig(
          thinking_config=types.ThinkingConfig(
              thinking_level="high",
              include_thoughts=True,
          )
      ),
  )
  
  for part in response.candidates[0].content.parts:
      if part.thought:
          print("Thought summary:", part.text)
      else:
          print("Answer:", part.text)
  ```

  {% /tab %}

  {% tab filename="thinking.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI, ThinkingLevel } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "Find the flaw in this distributed lock protocol and fix it.",
    config: {
      thinkingConfig: {
        thinkingLevel: ThinkingLevel.HIGH,
        includeThoughts: true,
      },
    },
  });
  
  for (const part of response.candidates[0].content.parts) {
    if (part.thought) {
      console.log("Thought summary:", part.text);
    } else {
      console.log("Answer:", part.text);
    }
  }
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Adaptive thinking

  Control how deeply Gemini reasons before responding—from zero-latency `minimal`
        thinking to deep multi-step `high` reasoning.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Configurable thinking levels** (minimal, low,
            medium, high)
  *   {% icon name="check" /%} **Transparent thought summaries** streamed in real
            time
  *   {% icon name="check" /%} **Interleaved reasoning** across tool calls and
            code execution

  {% /section %}

  {% button href="/docs/thinking" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Tools" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="tools.py" label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents="Who won the latest F1 Grand Prix and what were the lap times?",
      config=types.GenerateContentConfig(
          tools=[
              types.Tool(google_search=types.GoogleSearch()),
              types.Tool(code_execution=types.ToolCodeExecution()),
          ]
      ),
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab filename="tools.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "Who won the latest F1 Grand Prix and what were the lap times?",
    config: {
      tools: [{ googleSearch: {} }, { codeExecution: {} }],
    },
  });
  
  console.log(response.text);
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Built-in tools & function calling

  Connect Gemini to live information, computation, and your own backend APIs with
        hosted tools and custom function declarations.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Google Search & URL Context** for live web
            grounding
  *   {% icon name="check" /%} **Code Execution** in a secure Python sandbox
  *   {% icon name="check" /%} **Custom Function Calling** for parallel multi-tool
            orchestration

  {% /section %}

  {% button href="/docs/tools" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Structured" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="structured.py" label="Python" %}
  ```python
  from google import genai
  from pydantic import BaseModel, Field
  
  class FeedbackAnalysis(BaseModel):
      sentiment: str = Field(description="positive, neutral, or negative")
      summary: str = Field(description="One-sentence summary of the feedback.")
      action_items: list[str]
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents="The new dashboard is fast, but exporting CSVs fails on mobile.",
      config={
          "response_mime_type": "application/json",
          "response_json_schema": FeedbackAnalysis.model_json_schema(),
      },
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab filename="structured.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  import { z } from "zod";
  
  const FeedbackSchema = z.object({
    sentiment: z.enum(["positive", "neutral", "negative"]),
    summary: z.string(),
    actionItems: z.array(z.string()),
  });
  
  const ai = new GoogleGenAI({});
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "The new dashboard is fast, but exporting CSVs fails on mobile.",
    config: {
      responseMimeType: "application/json",
      responseJsonSchema: z.toJSONSchema(FeedbackSchema),
    },
  });
  
  console.log(JSON.parse(response.text));
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Structured outputs

  Constrain Gemini responses to follow a strict JSON Schema, Pydantic model, or
        Zod type for reliable downstream automation.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Guaranteed JSON Schema** compliance on every
            response
  *   {% icon name="check" /%} **Native Pydantic & Zod** schema integration
  *   {% icon name="check" /%} **Compatible with tools** like Google Search and
            Code Execution

  {% /section %}

  {% button href="/docs/structured-output" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Long context" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="long_context.py" label="Python" %}
  ```python
  from google import genai
  
  client = genai.Client()
  
  uploaded_file = client.files.upload(file="full_codebase_archive.txt")
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents=[
          uploaded_file,
          "Trace how authentication tokens are refreshed across all services.",
      ],
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab filename="long_context.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI, createPartFromUri } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const uploadedFile = await ai.files.upload({
    file: "full_codebase_archive.txt",
  });
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: [
      createPartFromUri(uploadedFile.uri, uploadedFile.mimeType),
      "Trace how authentication tokens are refreshed across all services.",
    ],
  });
  
  console.log(response.text);
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Long context

  Input up to 1 million tokens of code, video, audio, or documents in a single
        prompt for deep cross-file reasoning and in-context learning.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **1M+ token context window** (~50,000 lines of code
            or 8 novels)
  *   {% icon name="check" /%} **Near-perfect recall** across long multimodal
            inputs
  *   {% icon name="check" /%} **Context caching** to reduce cost and latency on
            repeated prompts

  {% /section %}

  {% button href="/docs/long-context" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Function calling" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="function_calling.py" label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  schedule_meeting = {
      "name": "schedule_meeting",
      "description": "Schedules a meeting with attendees at a given date and time.",
      "parameters": {
          "type": "object",
          "properties": {
              "attendees": {"type": "array", "items": {"type": "string"}},
              "date": {"type": "string"},
              "time": {"type": "string"},
              "topic": {"type": "string"},
          },
          "required": ["attendees", "date", "time", "topic"],
      },
  }
  
  client = genai.Client()
  tools = types.Tool(function_declarations=[schedule_meeting])
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents="Schedule a meeting with Bob and Alice tomorrow at 10:00 AM about Q3 planning.",
      config=types.GenerateContentConfig(tools=[tools]),
  )
  
  print(response.function_calls[0])
  ```

  {% /tab %}

  {% tab filename="function_calling.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI, Type } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const scheduleMeeting = {
    name: "schedule_meeting",
    description: "Schedules a meeting with attendees at a given date and time.",
    parameters: {
      type: Type.OBJECT,
      properties: {
        attendees: { type: Type.ARRAY, items: { type: Type.STRING } },
        date: { type: Type.STRING },
        time: { type: Type.STRING },
        topic: { type: Type.STRING },
      },
      required: ["attendees", "date", "time", "topic"],
    },
  };
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "Schedule a meeting with Bob and Alice tomorrow at 10:00 AM about Q3 planning.",
    config: {
      tools: [{ functionDeclarations: [scheduleMeeting] }],
    },
  });
  
  console.log(response.functionCalls[0]);
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Function calling

  Connect Gemini to your own APIs, databases, and backend services with structured
        function declarations and automatic argument extraction.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Parallel & compositional** multi-step function
            calls
  *   {% icon name="check" /%} **Strict schema adherence** for tool arguments
  *   {% icon name="check" /%} **Seamless integration** with built-in tools and
            thinking

  {% /section %}

  {% button href="/docs/function-calling" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

  {% tab label="Document understanding" %}
  {% two-column-layout class="capability-panel" %}
  {% left-column %}
  {% tabs %}
  {% tab filename="document_understanding.py" label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client()
  
  with open("financial_report.pdf", "rb") as f:
      pdf_bytes = f.read()
  
  response = client.models.generate_content(
      model="gemini-3.8-flash",
      contents=[
          types.Part.from_bytes(data=pdf_bytes, mime_type="application/pdf"),
          "Summarize the key revenue drivers and extract the Q4 table.",
      ],
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab filename="document_understanding.js" label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  import * as fs from "node:fs";
  
  const ai = new GoogleGenAI({});
  
  const pdfData = fs.readFileSync("financial_report.pdf", {
    encoding: "base64",
  });
  
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: [
      {
        inlineData: {
          data: pdfData,
          mimeType: "application/pdf",
        },
      },
      "Summarize the key revenue drivers and extract the Q4 table.",
    ],
  });
  
  console.log(response.text);
  ```

  {% /tab %}

  {% /tabs %}

  {% /left-column %}

  {% right-column class="capability-details" %}
### Document understanding

  Process up to 1,000 pages of PDFs with native visual and textual comprehension
        across tables, charts, diagrams, and layouts.

  {% section class="capability-highlights" %}
  *   {% icon name="check" /%} **Native vision-based PDF parsing** beyond plain
            OCR
  *   {% icon name="check" /%} **Up to 1,000 pages** per document in a single
            request
  *   {% icon name="check" /%} **Structured extraction** of complex tables, forms,
            and figures

  {% /section %}

  {% button href="/docs/document-processing" variant="ais" %}Read docs{% /button %}

  {% /right-column %}

  {% /two-column-layout %}

  {% /tab %}

{% /tabs %}

