> ## 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 # 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. To learn how Google uses logging data, see the [Data Logging and Sharing](/docs/logs-policy) policy doc. All `GenerateContent`, `BatchGenerateContent`, `StreamGenerateContent` API calls, and [Interactions](/docs/interactions-overview) API calls excluding Managed Agents are supported. This includes calls made through [OpenAI compatibility](/docs/openai) endpoints. {% callout type="note" %} Storage for Gemini API logs are only available for projects on the Gemini API paid tier. {% /callout %} ## Configure project logging {% id="configure-logging" %} By default, both the [Interactions](/docs/interactions-overview) API and the Generate Content API store requests (`store=true`). For the Interactions API, this also enables server-side state management features. {% callout type="note" %} Starting October 26, 2026, the Generate Content API stores requests by default for *new* projects. Projects created before this date keep their existing storage setting for the Generate Content API, which is off (`store=false`) unless previously enabled in AI Studio. {% /callout %} In Google [AI Studio](/logs) you can enable or disable storage for individual projects and change these preferences at any time through the **Settings** panel in your [Gemini API Logs Dashboard](https://aistudio.google.com/logs). You can toggle logging on or off independently for the `generateContent` API and the [Interactions](/docs/interactions-overview) API to change the default storage behavior for a project. {% callout type="warning" %} Toggling Interactions API logging *off* in the AI Studio **Settings** panel will prevent the API from automatically storing and retrieving conversation history unless explicitly overridden per-request. {% /callout %} ### Request-level logging {% id="request-logging" %} Both APIs store requests by default (`store=true`): * **[Interactions API](/docs/interactions-overview):** Stores requests by default to simplify server-side state management. * **Generate Content API (`generateContent`, `streamGenerateContent`, and `batchGenerateContent`):** Stores requests by default for projects created on or after October 26, 2026. Projects created before that date don't store requests by default (`store=false`) unless logging is enabled in AI Studio. The request-level `store` property takes precedence over the project-level setting. Setting `store` on Generate Content API requests requires `google-genai` 2.33.0 or later for Python, `@google/genai` 2.31.0 or later for JavaScript, `google-genai` 1.79.0 or later for Java, and `google.golang.org/genai` 1.76.0 or later for Go. Here is how you can set the `store` property: **GenerateContent API** {% tabs %} {% tab label="Python" %} ```python from google import genai client = genai.Client() response = client.models.generate_content( model='gemini-3.8-flash', contents='Explain quantum entanglement in simple terms.', config={'store': True} # Set to False to disable logging of this request ) print(response.text) ``` {% /tab %} {% tab label="JavaScript" %} ```javascript import { GoogleGenAI } from '@google/genai'; const client = new GoogleGenAI({}); const response = await client.models.generateContent({ model: 'gemini-3.8-flash', contents: 'Explain quantum entanglement in simple terms.', config: { store: true // Set to false to disable logging of this request } }); console.log(response.text); ``` {% /tab %} {% tab label="Java" %} ```java import com.google.genai.Client; import com.google.genai.types.GenerateContentConfig; import com.google.genai.types.GenerateContentResponse; Client client = new Client(); GenerateContentResponse response = client.models.generateContent( "gemini-3.8-flash", "Explain quantum entanglement in simple terms.", GenerateContentConfig.builder() .store(true) // Set to false to disable logging of this request .build()); System.out.println(response.text()); ``` {% /tab %} {% tab 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) } response, err := client.Models.GenerateContent( ctx, "gemini-3.8-flash", genai.Text("Explain quantum entanglement in simple terms."), &genai.GenerateContentConfig{ Store: genai.Ptr(true), // Set to false to disable logging of this request }, ) if err != nil { log.Fatal(err) } fmt.Println(response.Text()) } ``` {% /tab %} {% /tabs %} **Interactions API** {% tabs %} {% tab label="Python" %} ```python from google import genai client = genai.Client() interaction = client.interactions.create( model="gemini-3.8-flash", input="Explain quantum entanglement in simple terms.", store=True # Set to False to disable logging of this request ) print(interaction.outputs[-1].text) ``` {% /tab %} {% tab label="JavaScript" %} ```javascript import { GoogleGenAI } from '@google/genai'; const client = new GoogleGenAI({}); const interaction = await client.interactions.create({ model: 'gemini-3.8-flash', input: 'Explain quantum entanglement in simple terms.', store: true // Set to false to disable logging of this request }); console.log(interaction.output_text); ``` {% /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-3.8-flash")) .input(InteractionsInput.of("Explain quantum entanglement in simple terms.")) .store(true) // Set to false to disable logging of this request .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-3.8-flash"), Input: interactions.NewInteractionsInput("Explain quantum entanglement in simple terms."), Store: genai.Ptr(true), // Set to false to disable logging of this request }), }) if err != nil { log.Fatal(err) } if res.Interaction.OutputText != nil { fmt.Println(*res.Interaction.OutputText) } } ``` {% /tab %} {% /tabs %} ## View project logs in AI Studio {% id="view-logs" %} 1. Go to the Logs page in [AI Studio](/logs). 2. Select a project from the drop-down. 3. Logs will appear in the table in reverse chronological order, if they exist. 4. For projects created before October 26, 2026, first enable Generate Content API logging in the [settings panel](/docs/logs-datasets#configure-logging) to observe project logs for the Generate Content API. {% callout type="note" %} A project requires at least one active API key for logs to be displayed. If all API keys in a project are deleted (for example, if a leaked key was deleted), you will lose visibility of the project's logs until an API key is available. {% /callout %} Click an entry for a preview of the payload. You can inspect the full prompt and response from Gemini, and the context from the previous turns. For **Interactions API** requests, logs also include a direct link to the `previous_interaction_id`. ## Configure project storage retention {% id="retention" %} Logs will expire and be marked for deletion after a default retention window of 55 days (unless [saved to a dataset](/docs/logs-datasets#create), which don't expire). You can configure the retention window of a project's logs to 7, 14, 28, or 55 days max. ## Create and share datasets {% id="create" %} You can save logs to datasets to organize and export them more effectively. * From the [Logs page](https://aistudio.google.com/logs), locate the filter bar at the top to select a property to filter by. * From your filtered view, use the checkboxes to select all or individual logs. * Click the **Create dataset** button that appears at the top of the list. * Give your new dataset a name and optional description. * You will see the dataset you just created with the curated set of logs. * Export your dataset for further analysis as CSV, JSONL files or to Google Sheets. Datasets can be helpful for a number of different use cases. * **Curate challenge sets:** Drive future improvements that target areas where you want your AI to improve. * **Curate sample sets:** For example, a sample from real usage to generate responses from another model, or a collection of edge cases for routine checks before deployment. * **Evaluation sets:** Sets that are representative of real usage across important capabilities, for comparison across other models or system instruction iterations. You can contribute to Gemini research and development by choosing to share your datasets with Google as demonstration examples. ## Limitations {% id="limitations" %} Logging is not currently supported for the following: * Imagen and Veo models * Gemini embedding models * Gemini Robotics model * Inputs containing videos, GIFs or PDFs * Public Preview Agents in the Gemini API ## What's next {% id="next-steps" %} - **Prototype with session history:** Use [AI Studio Build](https://aistudio.google.com/apps) to vibe code apps and add your API key to enable a history of Gemini API logs for AI features. - **Re-run logs with the Gemini Batch API:** Use datasets for response sampling and evaluation of models or application logic by re-running logs with the [Gemini Batch API](https://github.com/google-gemini/cookbook/blob/main/examples/Datasets.ipynb).