Skip to content

litefuse/litefuse-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

litefuse-cli

Interact with the Litefuse API from the command line.

Forked from langfuse-cli (MIT). Litefuse is API-compatible with Langfuse, so this CLI keeps LANGFUSE_* env vars as a fallback for users migrating from langfuse-cli.

Install

# Run directly
npx litefuse-cli api <resource> <action>
bunx litefuse-cli api <resource> <action>

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

Configuration

Use an .env file (recommended, takes precedence):

litefuse --env .env api prompts list

You can get the values from your project settings. The .env file should contain:

LITEFUSE_PUBLIC_KEY=pk-lf-...
LITEFUSE_SECRET_KEY=sk-lf-...
LITEFUSE_HOST=https://litefuse.cloud  # optional, this is the default (LITEFUSE_BASE_URL also supported)

LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY / LANGFUSE_HOST / LANGFUSE_BASE_URL are still honored as fallbacks if the LITEFUSE_* equivalents are not set — so existing langfuse-cli setups keep working unchanged.

Alternatively, export env vars or pass inline flags:

export LITEFUSE_PUBLIC_KEY=pk-lf-...
export LITEFUSE_SECRET_KEY=sk-lf-...
export LITEFUSE_HOST=https://litefuse.cloud
litefuse api prompts list

# or inline
litefuse --public-key pk-lf-... --secret-key sk-lf-... api prompts list

Usage

# Discover all resources
litefuse api __schema

# List actions for a resource
litefuse api traces --help

# List traces
litefuse api traces list --limit 10

# Get a specific trace
litefuse api traces get <trace-id>

# JSON output (for piping/scripting)
litefuse api traces list --limit 5 --json

# Preview curl command
litefuse api traces list --limit 5 --curl

# Prompts
litefuse api prompts list
litefuse api prompts get --name my-prompt

# Datasets
litefuse api datasets list
litefuse api dataset-items list --dataset-name my-dataset

# Scores
litefuse api score-v2s get-scores --limit 20

Agent Usage

The latest Litefuse skill lives in litefuse/skills. Print the current version with:

litefuse get-skill

This fetches the latest skill from GitHub, so it stays up to date. Pipe it into an agent's context or include it in a system prompt.

API Reference

See the full Litefuse API Reference.

OpenAPI Patch Script

The bundled openapi.yml is post-processed by scripts/patch-openapi.ts to flatten discriminated unions (oneOf with allOf branches) into plain objects. This is needed because specli can only generate CLI flags from flat type: object schemas — it doesn't handle oneOf/allOf. Without the patch, endpoints like prompts create produce zero flags.

The patch runs automatically as part of bun run build. To fetch a fresh spec and patch it:

# From Litefuse cloud (default)
bun run refetch-openapi

# From a custom URL (e.g. local dev server)
bun run patch-openapi -- --refetch --openapi_url http://localhost:3000/generated/api/openapi.yml

# Patch only (no fetch)
bun run patch-openapi

About

Litefuse CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors