- Java 21+
- Langfuse stack (Cloud or Self-Hosted)
- Langfuse API Keys
- An OpenAI Api Key
- Configure environment variables to connect Spring AI demo app with Langfuse.
export SPRING_AI_OPENAI_APIKEY="sk-proj-xxx" export OTEL_EXPORTER_OTLP_ENDPOINT="https://cloud.langfuse.com/api/public/otel" # 🇪🇺 EU data region # export OTEL_EXPORTER_OTLP_ENDPOINT="https://us.cloud.langfuse.com/api/public/otel" # 🇺🇸 US data region # export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:3000/api/public/otel" # 🏠 Local deployment (>= v3.22.0) export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $(echo -n "pk-lf-xxx:sk-lf-xxx" | base64)" - Run the sample application with
./mvnw clean install spring-boot:run. - Call the chat endpoint with
curl localhost:8080/v1/chat. - Observe the new trace in the Langfuse web UI.
