Skip to main content
LangWatch traces calls to the Groq API. Groq provides an OpenAI-compatible endpoint, so you reuse the OpenAI otelopenai middleware: point the client at Groq’s base URL and label the spans with WithGenAIProvider.

Installation

Usage

Set LANGWATCH_API_KEY and GROQ_API_KEY environment variables before running.
The middleware captures input and output content by default. Pass otelopenai.WithDataCapture(langwatch.DataCaptureNone) to opt out.
The defer tp.Shutdown(ctx) call is essential. Without it, traces buffered in memory will be lost when your application exits.
Last modified on September 8, 2026