Skip to main content
LangWatch supports tracing Grok (xAI) API calls using the same otelopenai middleware used for OpenAI. Configure the client to point to the xAI endpoint.

Installation

Usage

Set LANGWATCH_API_KEY and XAI_API_KEY environment variables before running.
The defer tp.Shutdown(ctx) call is essential. Without it, traces buffered in memory will be lost when your application exits.