Logs and datasets

In this guide you'll learn how to view logs from Gemini API usage in the Google AI Studio dashboard to better understand model behavior and how users may be interacting with your applications. Use logging to observe, debug, and optionally share usage feedback with Google to help improve Gemini across developer use cases.*

All GenerateContent, BatchGenerateContent, StreamGenerateContent API calls, and Interactions API calls excluding Managed Agents are supported. This includes calls made through OpenAI compatibility endpoints.

Configure project logging

By default, the API stores all interaction objects (store=true) in order to simplify use of server-side state management features. In contrast, the Generate Content API does not store requests by default, and requires storage to be enabled per-request or at the project-level from AI Studio.

In Google AI Studio you can enable or disable logging for all projects or for specific projects and change these preferences at any time through the Settings panel in the Logs and Datasets page. Logging can be toggled on or off independently for the generateContent API and the Interactions API to change the default storage behavior for a project.

Request-level logging

Storage and logging behavior differs by API:

  • Interactions API: Stores requests by default (store=true) to simplify server-side state management.
  • Generate Content API (generateContent): Does not store requests by default (store=false).

Here is how you can set the store property:

GenerateContent API

Python

from google import genai

client = genai.Client()

response = client.models.generate_content(
    model='gemini-3.7-flash',
    contents='Explain quantum entanglement in simple terms.',
    config={'store': False} # Set to True to enable logging of this request
)

print(response.text)

JavaScript

import { GoogleGenAI } from '@google/genai';

const client = new GoogleGenAI({});

const response = await client.models.generateContent({
    model: 'gemini-3.7-flash',
    contents: 'Explain quantum entanglement in simple terms.',
    config: {
        store: false // Set to true to enable logging of this request
    }
});

console.log(response.text);