Skip to main content
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:
  3. Route the Gateway to your Vertex provider in your Gateway configuration.
  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:

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