Signature
Parameters
Any
required
Any LLM client instance. Auto-detects the provider.Supported: OpenAI, Anthropic, Google GenAI, LiteLLM, Cohere, Mistral.
bool
default:"False"
When
True, captures prompt and response content in trace spans.Returns
A transparent proxy that behaves exactly like the original client, but emits OpenTelemetry spans for every API call.Basic Usage
Supported Providers
OpenAI
Anthropic
Google GenAI
LiteLLM
Cohere
Mistral
What Gets Traced
Every LLM API call emits an OTel span with GenAI semantic conventions:Metrics
Streaming Support
hexr_llm() handles streaming responses transparently:
Async Support
Cost Attribution
With per-process SPIFFE identity,hexr_llm() enables precise cost tracking:
LLM Guard Integration
When LLM Guard is enabled,hexr_llm() automatically scans prompts and responses:
LLM Guard scanning happens transparently when
HEXR_LLM_GUARD_ENABLED=true.
No code changes needed.