Gemini
Google's Gemini models include Gemini 2.0 Flash, Gemini 2.5 Pro, and other advanced multimodal language models. Braintrust integrates seamlessly with Gemini through direct API access, wrapper functions for automatic tracing, and proxy support.
Setup
To use Gemini models, configure your Gemini API key in Braintrust.
- Get a Gemini API key from Google AI Studio
- Add the Gemini API key to your organization's AI providers
- Set the Gemini API key and your Braintrust API key as environment variables
API keys are encrypted using 256-bit AES-GCM encryption and are not stored or logged by Braintrust.
Use Gemini with Braintrust AI proxy
The Braintrust AI Proxy allows you to access Gemini models through a unified OpenAI-compatible interface.
Install the braintrust
and openai
packages.
pnpm add braintrust openai
Then, initialize the client and make a request to a Gemini model via the Braintrust AI Proxy.
Trace logs with Gemini
Trace your Gemini LLM calls for observability and monitoring.
When using the Braintrust AI Proxy, API calls are automatically logged to the specified project.
The Braintrust AI Proxy is not required to trace Gemini API calls. For more control, learn how to customize traces.
Stream Gemini responses
Gemini models support streaming:
Evaluate with Gemini
Evaluations distill the non-deterministic outputs of Gemini models into an effective feedback loop that enables you to ship more reliable, higher quality products. Braintrust Eval
is a simple function composed of a dataset of user inputs, a task, and a set of scorers. To learn more about evaluations, see the Experiments guide.
Gemini reasoning model support
Gemini reasoning models support unified reasoning parameters.
To learn more about tool use, multimodal support, attachments, and masking sensitive data with Gemini, visit the customize traces guide.
Models and capabilities
Model | Multimodal | Reasoning | Max input | Max output | Input $/1M | Output $/1M |
---|---|---|---|---|---|---|
gemini-2.5-flash | 1,048,576 | 65,535 | $0.30 | $2.50 | ||
gemini-2.5-flash-preview-05-20 | 1,048,576 | 65,535 | $0.30 | $2.50 | ||
gemini-2.5-flash-preview-04-17 | 1,048,576 | 65,535 | $0.15 | $0.60 | ||
gemini-2.5-pro | 1,048,576 | 65,535 | $1.25 | $10.00 | ||
gemini-2.5-pro-preview-06-05 | 1,048,576 | 65,535 | $1.25 | $10.00 | ||
gemini-2.5-pro-preview-05-06 | 1,048,576 | 65,535 | $1.25 | $10.00 | ||
gemini-2.5-pro-preview-03-25 | 1,048,576 | 65,535 | $1.25 | $10.00 | ||
gemini-2.5-pro-exp-03-25 | 1,048,576 | 65,535 | $1.25 | $10.00 | ||
gemini-2.0-pro-exp-02-05 | 2,097,152 | 8,192 | $1.25 | $10.00 | ||
gemini-2.5-flash-lite | 1,048,576 | 65,535 | $0.10 | $0.40 | ||
gemini-2.5-flash-lite-preview-06-17 | 1,048,576 | 65,535 | $0.10 | $0.40 | ||
gemini-2.0-flash | 1,048,576 | 8,192 | $0.10 | $0.40 | ||
gemini-2.0-flash-001 | 1,048,576 | 8,192 | $0.15 | $0.60 | ||
gemini-2.0-flash-exp | 1,048,576 | 8,192 | $0.15 | $0.60 | ||
gemini-2.0-flash-thinking-exp-01-21 | 1,048,576 | 65,536 | $0 | $0 | ||
gemini-2.0-flash-lite | 1,048,576 | 8,192 | $0.075 | $0.30 | ||
gemini-2.0-flash-lite-001 | 1,048,576 | 8,192 | $0.075 | $0.30 | ||
gemini-1.5-flash | 1,000,000 | 8,192 | $0.075 | $0.30 | ||
gemini-1.5-flash-latest | 1,048,576 | 8,192 | $0.075 | $0.30 | ||
gemini-1.5-flash-001 | 1,000,000 | 8,192 | $0.075 | $0.30 | ||
gemini-1.5-flash-002 | 1,048,576 | 8,192 | $0.075 | $0.30 | ||
gemini-1.5-flash-8b | 1,048,576 | 8,192 | $0 | $0 | ||
gemini-1.5-flash-8b-latest | ﹣ | ﹣ | $0.038 | $0.15 | ||
gemini-1.5-flash-8b-001 | ﹣ | ﹣ | $0.038 | $0.15 | ||
gemini-1.5-pro | 2,097,152 | 8,192 | $1.25 | $5.00 | ||
gemini-1.5-pro-latest | 1,048,576 | 8,192 | $3.50 | $1.05 | ||
gemini-1.5-pro-001 | 1,000,000 | 8,192 | $1.25 | $5.00 | ||
gemini-1.5-pro-002 | 2,097,152 | 8,192 | $1.25 | $5.00 | ||
learnlm-1.5-pro-experimental | 32,767 | 8,192 | $0 | $0 | ||
gemini-exp-1206 | 2,097,152 | 8,192 | $0 | $0 | ||
gemini-1.0-pro | 32,760 | 8,192 | $0.50 | $1.50 | ||
gemini-pro | 32,760 | 8,192 | $0.50 | $1.50 |