<img width="2400" height="600" alt="hero-b" src="https://github.com/user-attachments/assets/85dcdba4-c037-4e3e-9f20-e39cde0a15ec" /
langfuse-cli
Interact with the Langfuse API from the command line.
Install
# Run directly
npx langfuse-cli api <resource> <action>
bunx langfuse-cli api <resource> <action>
# Or install globally
npm i -g langfuse-cli
langfuse api <resource> <action>Configuration
Use an .env file (recommended, takes precedence):
langfuse --env .env api prompts listYou can get the values from your project settings. The .env file should contain:
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://cloud.langfuse.com # optional, this is the default (LANGFUSE_BASE_URL also supported)Alternatively, export env vars or pass inline flags:
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_HOST=https://cloud.langfuse.com
langfuse api prompts list
# or inline
langfuse --public-key pk-lf-... --secret-key sk-lf-... api prompts listUsage
# Discover all resources
langfuse api __schema
# List actions for a resource
langfuse api traces --help
# List traces
langfuse api traces list --limit 10
# Get a specific trace
langfuse api traces get <trace-id>
langfuse api traces list --limit 5 --json
Preview curl command
langfuse api traces list --limit 5 --curl