How to Use the new Gemini 2.5 06-05 Pro API

Learn how to use the Gemini 2.5 06-05 Pro API in this technical guide. Set up, authenticate, and explore multimodal and coding features of Google’s powerful AI model. Perfect for developers building advanced apps!

Ashley Innocent

Ashley Innocent

6 June 2025

How to Use the new Gemini 2.5 06-05 Pro API

Google’s latest iteration of the Gemini model family, released in preview on June 5, 2025, brings exceptional capabilities to developers. This API empowers you to build advanced, multimodal applications that process text, images, video, and more, while excelling in reasoning and coding tasks. Whether you aim to create interactive web apps, analyze complex datasets, or automate workflows, this guide walks you through the process with precision.

💡
Before we proceed, streamline your API testing and integration with Apidog! Download Apidog for free to simplify sending requests, debugging responses, and managing workflows for the Gemini 2.5 06-05 Pro API. It’s a perfect companion for developers working with cutting-edge AI models. Get started today!
button

Now, let’s explore the setup, configuration, and practical use cases to harness the full potential of this powerful API.

What Is the Gemini 2.5 06-05 Pro API?

The Gemini 2.5 06-05 Pro API, developed by Google DeepMind, represents a pinnacle in multimodal AI technology. Released as an upgraded preview on June 5, 2025, this model builds on previous versions, delivering superior performance in coding, reasoning, and creative tasks. It boasts a 1-million-token context window (with 2 million on the horizon), enabling it to handle extensive codebases, documents, and multimedia inputs like images and videos.

Moreover, the API excels in benchmarks, leading the WebDev Arena leaderboard with a 24-point Elo score jump to 1470 and scoring 84.8% on VideoMME for video understanding. Its reasoning capabilities shine in math, science, and coding, making it ideal for developers building sophisticated applications. Next, we’ll set up your environment to start using this API effectively.

Prerequisites for Using the Gemini 2.5 06-05 Pro API

Before you begin, ensure your development environment meets these requirements:

First, install Python and set up a virtual environment. Run these commands in your terminal:

python -m venv gemini_env
source gemini_env/bin/activate  # On Windows: gemini_env\Scripts\activate

Then, install the required library:

pip install google-generativeai

With these steps complete, you’re ready to configure the API. Let’s move forward to authentication and setup.

Setting Up Authentication for the Gemini 2.5 06-05 Pro API

To use the Gemini 2.5 06-05 Pro API, authenticate your requests with an API key. Follow these steps to get started:

  1. Navigate to Google AI Studio: Open your browser and go to aistudio.google.com.

Sign In: Use your Google account credentials to log in.

Generate API Key: Locate the “Get API key” option in the dashboard. Click it, follow the prompts, and copy the generated key. Store it securely—never share it publicly.

Click it, follow the prompts, and copy the generated key. Store it securely—never share it publicly.

Set Environment Variable: For security, set the key as an environment variable. In your terminal, run:

export GEMINI_API_KEY='your_api_key_here'  # On Windows: set GEMINI_API_KEY=your_api_key_here

Now, initialize the client in Python. Here’s a basic setup:

import os
from google import genai

# Retrieve API key from environment variable
API_KEY = os.environ.get("GEMINI_API_KEY")
client = genai.Client(api_key=API_KEY)

With authentication configured, you’re set to send requests. Next, we’ll explore making your first API call with the Gemini 2.5 06-05 model.

Making Your First API Call with Gemini 2.5 06-05

Let’s test the Gemini 2.5 06-05 Pro API with a simple text-based request. This example asks the model to explain a basic concept. Use this Python code:

from google import genai
from google.genai.types import HttpOptions

# Initialize client
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Send a text request
response = client.models.generate_content(
    model="gemini-2.5-pro-preview-06-05",
    contents="Explain how a neural network works in simple terms."
)

# Print the response
print(response.text)

This code sends a POST request to the API endpoint, targeting the Gemini 2.5 06-05 model. The response explains neural networks in clear, concise language. Expect output like:

A neural network is a computing model inspired by the human brain. It consists of layers of nodes (neurons) that process input data, adjust weights based on patterns, and produce an output, such as a prediction or classification.

To verify functionality, test this request in Apidog. Create a new project, set the HTTP method to POST, enter the endpoint URL (found in Google AI Studio docs), add the header Authorization: Bearer YOUR_API_KEY, and include the JSON payload:

{
    "model": "gemini-2.5-pro-preview-06-05",
    "contents": "Explain how a neural network works in simple terms."
}

Click “Send” in Apidog to check the response, status code, and timing. This confirms your setup works. Now, let’s advance to multimodal capabilities.

Leveraging Multimodal Features of Gemini 2.5 06-05

The Gemini 2.5 06-05 Pro API shines with its multimodal capabilities, processing text, images, and video. This section shows you how to use these features effectively.

Text and Image Processing

Combine text prompts with images for tasks like image analysis. Upload an image (e.g., a photo of scones) and ask the model to describe it. Here’s the code:

from google import genai
from google.genai.types import HttpOptions, Part

# Initialize client
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Send a text and image request
response = client.models.generate_content(
    model="gemini-2.5-pro-preview-06-05",
    contents=[
        "Describe this image in detail.",
        Part.from_uri(
            file_uri="gs://cloud-samples-data/generative-ai/image/scones.jpg",
            mime_type="image/jpeg"
        )
    ]
)

# Print the response
print(response.text)

The model might respond:

The image shows a flat lay of blueberry scones on parchment paper. Six triangular scones, golden-brown, are arranged in a circular pattern, with fresh blueberries scattered around. The texture appears crumbly, typical of well-baked scones.

Ensure your image is accessible via a Google Cloud Storage URI or upload it directly if supported. This capability suits applications like e-commerce or content analysis.

Video Understanding

The Gemini 2.5 06-05 model excels in video understanding, scoring 84.8% on the VideoMME benchmark. Submit a YouTube URL or video file with a prompt to analyze content. For example:

from google import genai
from google.genai.types import HttpOptions

# Initialize client
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Send a video request
response = client.models.generate_content(
    model="gemini-2.5-pro-preview-06-05",
    contents=[
        "Create a spec for a learning app based on this video.",
        "https://www.youtube.com/watch?v=example_video"
    ]
)

# Print the response
print(response.text)

This generates a detailed spec for an interactive learning app, leveraging the video’s content. The API processes up to 6 hours of video with a 2-million-token context window at the “low” media resolution setting, balancing cost and performance.

With multimodal features mastered, let’s tackle coding assistance next.

Coding with the Gemini 2.5 06-05 Pro API

The Gemini 2.5 06-05 Pro API dominates coding tasks, leading the WebDev Arena leaderboard with a 1470 Elo score. It generates, edits, and debugs code across languages like Python, JavaScript, and more. Here’s how to use it:

Generating Code

Request a function, such as a Fibonacci sequence calculator. Try this:

from google import genai
from google.genai.types import HttpOptions

# Initialize client
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Send a coding request
response = client.models.generate_content(
    model="gemini-2.5-pro-preview-06-05",
    contents="Write a Python function to calculate the Fibonacci sequence up to n terms."
)

# Print the response
print(response.text)

The output might be:

def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    sequence = [0, 1]
    for i in range(2, n):
        sequence.append(sequence[i-1] + sequence[i-2])
    return sequence

# Example usage
print(fibonacci(10))  # Output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

This function is efficient and correct, showcasing the model’s reasoning.

Debugging and Optimization

Submit existing code for analysis. For example:

from google import genai
from google.genai.types import HttpOptions

# Initialize client
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Send a debugging request
response = client.models.generate_content(
    model="gemini-2.5-pro-preview-06-05",
    contents="Debug this code for errors and suggest improvements: def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2)"
)

# Print the response
print(response.text)

The model might respond:

The recursive Fibonacci function has a flaw: it’s highly inefficient for large n due to redundant calculations, leading to exponential time complexity. Here’s an improved version using iteration:
def fib(n):
    if n < 0:
        raise ValueError("Input must be non-negative")
    if n == 0:
        return 0
    elif n == 1:
        return 1
    a, b = 0, 1
    for _ in range(2, n + 1):
        a, b = b, a + b
    return b
Improvements: Added error handling for negative inputs; replaced recursion with iteration for O(n) time complexity; used tuple unpacking for clarity.

This enhances performance significantly. Now, let’s explore advanced use cases.

Advanced Use Cases for Gemini 2.5 06-05 Pro API

The Gemini 2.5 06-05 Pro API unlocks sophisticated applications. Consider these scenarios:

To test these, use Apidog to mock API responses and validate functionality. Transitioning to best practices ensures optimal results.

Best Practices for Gemini 2.5 06-05 Pro API

Maximize the Gemini 2.5 06-05 Pro API with these tips:

By following these, you ensure efficiency and reliability. Let’s wrap up.

Conclusion: Harnessing Gemini 2.5 06-05 Pro API

The Gemini 2.5 06-05 Pro API empowers developers to build cutting-edge applications. From setup and authentication to multimodal processing and coding, this guide equips you to leverage its power. Its leadership in WebDev Arena, strong video understanding, and reasoning capabilities make it a game-changer. Start building today—experiment in Google AI Studio, integrate with Vertex AI, or test in the Gemini app. With practice, you’ll create innovative solutions effortlessly.

button


Explore more

How to Use Deepseek R1 Locally with Cursor

How to Use Deepseek R1 Locally with Cursor

Learn how to set up and configure local DeepSeek R1 with Cursor IDE for private, cost-effective AI coding assistance.

4 June 2025

How to Run Gemma 3n on Android ?

How to Run Gemma 3n on Android ?

Learn how to install and run Gemma 3n on Android using Google AI Edge Gallery.

3 June 2025

How to Use Google Search Console MCP Server

How to Use Google Search Console MCP Server

This guide details Google Search Console MCP for powerful SEO analytics and Apidog MCP Server for AI-driven API development. Learn to install, configure, and leverage these tools to boost productivity and gain deeper insights into your web performance and API specifications.

30 May 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs