xiaohongshu
xiaohongshu
langfuse-install-auth
Install and configure Langfuse SDK authentication for LLM observability. Use when setting up a new Langfuse integration, configuring API keys, or initializing Langfuse tracing in your project. Trigger with phrases like "install langfuse", "setup langfuse", "langfuse auth", "configure langfuse API...
Full skill instructions
Set up Langfuse SDK and configure authentication for LLM observability and tracing.
# Node.js / TypeScript
npm install langfuse
# or
pnpm add langfuse
# Python
pip install langfuse
https://cloud.langfuse.com)# Set environment variables
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_HOST="https://cloud.langfuse.com" # or self-hosted URL
# Or create .env file
cat >> .env << 'EOF'
LANGFUSE_PUBLIC_KEY=pk-lf-your-public-key
LANGFUSE_SECRET_KEY=sk-lf-your-secret-key
LANGFUSE_HOST=https://cloud.langfuse.com
EOF
// TypeScript verification
import { Langfuse } from "langfuse";
const langfuse = new Langfuse({
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
secretKey: process.env.LANGFUSE_SECRET_KEY,
baseUrl: process.env.LANGFUSE_HOST,
});
// Create a test trace
const trace = langfuse.trace({
name: "connection-test",
metadata: { test: true },
});
// Flush to ensure data is sent
await langfuse.flushAsync();
console.log("Langfuse connection successful! Check dashboard for trace.");
# Python verification
from langfuse import Langfuse
import os
langfuse = Langfuse(
public_key=os.environ.get("LANGFUSE_PUBLIC_KEY"),
secret_key=os.environ.get("LANGFUSE_SECRET_KEY"),
host=os.environ.get("LANGFUSE_HOST"),
)
# Create a test trace
trace = langfuse.trace(name="connection-test", metadata={"test": True})
# Flush to ensure data is sent
langfuse.flush()
print("Langfuse connection successful! Check dashboard for trace.")
| Error | Cause | Solution |
|---|---|---|
| Invalid API Key | Incorrect or revoked key | Verify keys in Langfuse dashboard |
| Connection Refused | Wrong host URL | Check LANGFUSE_HOST is correct |
| Network Error | Firewall blocking | Ensure outbound HTTPS to Langfuse host |
| Module Not Found | Installation failed | Run npm install or pip install again |
| 401 Unauthorized | Keys don't match project | Ensure keys are from same project |
import { Langfuse } from "langfuse";
const langfuse = new Langfuse({
publicKey: process.env.LANGFUSE_PUBLIC_KEY!,
secretKey: process.env.LANGFUSE_SECRET_KEY!,
baseUrl: process.env.LANGFUSE_HOST,
// Optional configuration
flushAt: 15, // Flush after 15 events (default: 15)
flushInterval: 10000, // Flush every 10 seconds (default: 10000ms)
requestTimeout: 10000, // Request timeout (default: 10000ms)
enabled: process.env.NODE_ENV === "production", // Disable in dev
});
// Ensure clean shutdown
process.on("beforeExit", async () => {
await langfuse.shutdownAsync();
});
from langfuse import Langfuse
import os
langfuse = Langfuse(
public_key=os.environ.get("LANGFUSE_PUBLIC_KEY"),
secret_key=os.environ.get("LANGFUSE_SECRET_KEY"),
host=os.environ.get("LANGFUSE_HOST"),
# Optional configuration
flush_at=15, # Flush after 15 events
flush_interval=10.0, # Flush every 10 seconds
enabled=os.environ.get("NODE_ENV") == "production",
)
# Register shutdown handler
import atexit
atexit.register(langfuse.flush)
import { observeOpenAI } from "langfuse";
import OpenAI from "openai";
const openai = observeOpenAI(new OpenAI(), {
clientInitParams: {
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
secretKey: process.env.LANGFUSE_SECRET_KEY,
baseUrl: process.env.LANGFUSE_HOST,
},
});
// All OpenAI calls are now automatically traced
const response = await openai.chat.completions.create({
model: "gpt-4",
messages: [{ role: "user", content: "Hello!" }],
});
After successful auth, proceed to langfuse-hello-world for your first trace.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience