Skip to main content
Install google-genai in your application and create a wrapped client using the Python quickstart. Pass the provider ID in wrap() so Brello can distinguish the two backends. Set BRELLO_API_KEY to your Brello project ingestion key. Automatic imports of Google billing data are not yet available.

Send a request

Set GEMINI_MODEL to a model available to your Google backend.
Use await client.aio.models.generate_content(...) for async code. Brello collects the model, available token counts, and a response ID when Google provides one. Your application can read the original response as usual.

Supported methods

The same methods are supported on client.aio.models. Brello records one event per wrapped SDK method call. Input totals include tool-use prompt tokens and output totals include thinking tokens when Google reports them. Cached input is included in total input and reported separately as a subset. Brello records usage: null when no usable counts are available. With automatic function calling, Google can make multiple model requests for one SDK call. For generate_content(), Google exposes only the final tool round’s usage, so Brello’s estimate can omit earlier rounds. For generate_content_stream(), Brello sums the final usage from each tool round when Google includes function call history and all observed rounds include usable counts. Keep ignore_call_history at its default to identify round boundaries. Without the history, Brello uses the latest reported counts. If an identified round is missing counts, Brello uses usage: null.

Track streaming usage

In async code, await client.aio.models.generate_content_stream(...), consume the result with async for, and call await brello.aflush() before a short-lived script exits. Consume the stream to completion to capture final usage. If you stop early, call close() or await aclose() to record the cancellation. See configuration and delivery for user and feature attribution and privacy and collection for data handling.