Each directory contains a standalone main.go demonstrating a specific use case.
| Directory | Description | Required env vars |
|---|---|---|
| openai | OpenAI chat completions + streaming | OPENAI_API_KEY |
| anthropic | Anthropic Messages API + streaming | ANTHROPIC_API_KEY |
| gemini | Google Gemini GenerateContent + streaming | GEMINI_API_KEY |
| xai | xAI (Grok) chat completions + streaming | XAI_API_KEY |
| Directory | Description | Required env vars |
|---|---|---|
| custom-middleware | Build your own middleware using http.RoundTripper |
OPENAI_API_KEY |
| read-api | Query traces, observations, scores, sessions, datasets, prompts | -- |
All examples require LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY to be set.
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export OPENAI_API_KEY="sk-..."
go run ./examples/openai