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

# Pass Gemini Google Search via Braintrust Gateway

> Enable Google Search grounding for Gemini models through the Braintrust Gateway.

> [!NOTE]
>
> **Applies to:**
>
> * Plan - Any
> * Deployment - Braintrust-hosted
> *
> * Use case - How to enable and route Gemini Google Search grounding (provider-managed googleSearch tool) through the Braintrust Gateway and which endpoints support it

## Summary

You cannot pass Gemini's native `googleSearch` tool via the `/chat/completions` endpoint because its OpenAI-style function schemas cannot carry provider-managed Gemini tools. Use the Gateway native `generateContent` route and include `tools: [{googleSearch: {}}]` to enable Google Search grounding.

## What is happening

Gemini provider-managed tools such as `googleSearch` run inside the model request. The Gateway routes native `generateContent` requests to your configured Vertex provider.

## Fix or suggestion

### Use the Gateway native generateContent route

1. Send a POST request to `https://gateway.braintrust.dev/v1beta/models/gemini-2.5-flash:generateContent`.

2. Include the `tools` array with the `googleSearch` tool in the native request body:

   ```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
   {
     "contents": [{"role": "user", "parts": [{"text": "Find recent news about X"}]}],
     "tools": [{ "googleSearch": {} }]
   }
   ```

3. Route the Gateway to your Vertex provider in your [Gateway configuration](https://docs.braintrust.dev/deploy/gateway.md).

4. Enable Gateway logging by setting the `x-bt-parent` header to `project_name:YOUR_PROJECT_NAME`, replacing `YOUR_PROJECT_NAME` with your Braintrust project name.

With `BRAINTRUST_API_KEY` set to your Braintrust API key, send the complete request:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl -X POST https://gateway.braintrust.dev/v1beta/models/gemini-2.5-flash:generateContent \
  -H "Authorization: Bearer $BRAINTRUST_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-bt-parent: project_name:YOUR_PROJECT_NAME" \
  -d '{
    "contents": [{"role": "user", "parts": [{"text": "Find recent news about X"}]}],
    "tools": [{ "googleSearch": {} }]
  }'
```

## How to confirm it worked

* Inspect the model response in the Braintrust request trace for `groundingMetadata` with source references. Enabling `googleSearch` does not guarantee that every response is grounded.

## Notes

* [Braintrust Gateway documentation](https://docs.braintrust.dev/deploy/gateway.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.