Back to Langfuse

Langfuse CLI Reference

packages/shared/src/in-app-agent/server/skills/generated/raw/cli.md

4.0.01.9 KB
Original Source

Langfuse CLI Reference

Documentation: https://langfuse.com/docs/api-and-data-platform/features/cli

Install

bash
# Run directly (recommended)
npx langfuse-cli api <resource> <action>
bunx langfuse-cli api <resource> <action>

# Or install globally
npm i -g langfuse-cli
langfuse api <resource> <action>

Discovery

bash
# List all resources and auth info
langfuse api __schema

# List actions for a resource
langfuse api <resource> --help

# Show args/options for a specific action
langfuse api <resource> <action> --help

# Preview the curl command without executing
langfuse api <resource> <action> --curl

Credentials

Set environment variables:

bash
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_BASE_URL=https://cloud.langfuse.com  

Tips

  • Use --json for machine-readable JSON output
  • Use --curl to preview the HTTP request without executing
  • All list commands support filtering — check <resource> <action> --help for available options
  • Prefer observations over legacy-observations-v1sobservations is the modern high-performance endpoint (cursor pagination, selective field groups); legacy-observations-v1s is the deprecated v1
  • Prefer metrics over legacy-metrics-v1s for the same reason
  • Prefer scores over legacy-score-v1s for list/get operations
  • For broad trace queries, traces list can time out on Langfuse Cloud — use observations list (with --trace-id if you're traversing from a known trace) instead. See the Observations API docs for the v1 → v2 mapping.
  • Pagination: legacy v1 endpoints use --limit and --page; modern endpoints (observations, metrics, scores) use cursor-based pagination — pass --limit, then thread meta.cursor from the response into the next request's --cursor