Google GenAI (tracing)
Google GenAI (tracing)
The official Google Gen AI SDK (google-genai) is the Python client for Gemini models, supporting text, multimodal prompts, streaming, tool use, and structured outputs. Respan gives you full observability over every Gemini generation, streamed response, token count, and model tool call — and gateway routing through the Respan endpoint.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See Google Gen AI gateway setup to route this integration through the Respan gateway.
Example projects
Setup
Set environment variables
If GOOGLE_API_KEY is not set, route through the Respan Gemini gateway with RESPAN_API_KEY. Gateway calls require Gemini provider credentials or managed credits configured on your Respan account.
View your trace
Open the Traces page to see your Gemini span with prompt content, completion content, model name, token usage, and tool-call attributes.
Configuration
Attributes
In Respan()
Set defaults at initialization — these apply to all generated spans.
With propagate_attributes
Override per-request using a context scope.