> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini

> Learn how to integrate Gemini with HoneyHive

export const integrationType_1 = "Gemini"

export const integrationType_0 = "Gemini"

Gemini is Google's family of AI models that are designed to be helpful, safe, and powerful.

With HoneyHive, you can trace all your {integrationType_0} operations using a single line of code. Find a list of all supported integrations [here](/introduction/troubleshooting#latest-package-versions-tested).

## HoneyHive Setup

Follow the [HoneyHive Installation Guide](/integrations/integration-prereqs) to get your API key and initialize the tracer.

## Gemini Setup

Go to [Google AI Studio](https://aistudio.google.com/) to get your Gemini API key.

Note: please use version `google-genai==1.13.0` for Python.

## Example

Here is an example of how to trace your {integrationType_1} code in HoneyHive.

<CodeGroup>
  ```python Python    theme={null}
  from google import genai

  from honeyhive import HoneyHiveTracer, trace

  HoneyHiveTracer.init(
      api_key="MY_HONEYHIVE_API_KEY",
      project="MY_HONEYHIVE_PROJECT_NAME",
  )

  @trace
  def generate_response(query):
      client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))

      response = client.models.generate_content(
          model="gemini-2.0-flash", contents=query
      )

      print(response.text)
      return response.text

  generate_response("The opposite of hot is")
  ```

  ```typescript TypeScript theme={null}
  import { GoogleGenAI } from "@google/genai";
  import { HoneyHiveTracer } from 'honeyhive';

  const tracer = await HoneyHiveTracer.init({
      apiKey: 'MY_HONEYHIVE_API_KEY',
      project: 'MY_HONEYHIVE_PROJECT_NAME',
      sessionName: 'gemini',
  });

  async function generateResponse(input: string): Promise<string> {
      const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY" });

      const response = await ai.models.generateContent({
          model: "gemini-2.0-flash",
          contents: input,
      });

      console.log(response.text);

      return response.text;
  }

  const tracedGenerateResponse = tracer.traceFunction()(generateResponse);

  tracedGenerateResponse("The opposite of hot is");
  ```
</CodeGroup>

## View your Traces

Once you run your code, you can view your execution trace in the HoneyHive UI by clicking the `Log Store` tab on the left sidebar.

<img src="https://mintcdn.com/honeyhiveai/oxFnPfpA79Ja1RXX/images/traces/gemini-trace.png?fit=max&auto=format&n=oxFnPfpA79Ja1RXX&q=85&s=a5e5afa25758e50e8070c0aa6e364ec3" alt="Gemini Traces" width="1116" height="899" data-path="images/traces/gemini-trace.png" />
