langfuse

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Langfuse

Langfuse

Two core capabilities: programmatic API access via the Langfuse CLI, and documentation retrieval via llms.txt, page fetching, and search.
两大核心功能:通过Langfuse CLI实现程序化API访问,以及通过llms.txt、页面获取和搜索实现文档检索

1. Langfuse API via CLI

1. 基于CLI的Langfuse API访问

Use the
langfuse-cli
to interact with the full Langfuse REST API from the command line. Run via npx (no install required):
bash
npx langfuse-cli api <resource> <action>
使用
langfuse-cli
从命令行与完整的Langfuse REST API进行交互。通过npx运行(无需安装):
bash
npx langfuse-cli api <resource> <action>

Quick Start

快速开始

bash
undefined
bash
undefined

Discover all available resources

发现所有可用资源

npx langfuse-cli api __schema
npx langfuse-cli api __schema

List actions for a resource

列出某一资源的可用操作

npx langfuse-cli api <resource> --help
npx langfuse-cli api <resource> --help

Show args/options for a specific action

查看特定操作的参数/选项

npx langfuse-cli api <resource> <action> --help
undefined
npx langfuse-cli api <resource> <action> --help
undefined

Credentials

凭证

Set environment variables before making calls:
bash
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_HOST=https://cloud.langfuse.com  # optional, default is EU
If not set, ask the user for their API keys (found in Langfuse UI → Settings → API Keys) and which host they use (
cloud.langfuse.com
,
us.cloud.langfuse.com
, or self-hosted URL).
在调用前设置环境变量:
bash
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_HOST=https://cloud.langfuse.com  # 可选,默认是欧洲节点
如果未设置,需向用户询问其API密钥(可在Langfuse UI → 设置 → API密钥中找到)以及使用的主机地址(
cloud.langfuse.com
us.cloud.langfuse.com
或自托管URL)。

Detailed CLI Reference

详细CLI参考

For common workflows, tips, and full usage patterns, see references/cli.md.
如需了解常见工作流、技巧和完整使用模式,请查看references/cli.md

2. Langfuse Documentation

2. Langfuse文档

Three methods to access Langfuse docs, in order of preference:
三种访问Langfuse文档的方式,按优先级排序:

2a. Documentation Index (llms.txt)

2a. 文档索引(llms.txt)

Fetch the full index of all documentation pages:
bash
curl -s https://langfuse.com/llms.txt
Returns a structured list of every doc page with titles and URLs. Use this to discover the right page for a topic, then fetch that page directly.
Alternatively, you can start on
https://langfuse.com/docs
and explore the site to find the page you need.
获取所有文档页面的完整索引:
bash
curl -s https://langfuse.com/llms.txt
返回包含所有文档页面标题和URL的结构化列表。使用此索引查找对应主题的页面,然后直接获取该页面内容。
或者,你也可以从
https://langfuse.com/docs
开始浏览站点以找到所需页面。

2b. Fetch Individual Pages as Markdown

2b. 获取单个页面的Markdown版本

Any page listed in llms.txt can be fetched as markdown by appending
.md
to its path or by using Accept: text/markdown in the request headers. Use this when you know which page contains the information needed. Returns clean markdown with code examples and configuration details.
bash
curl -s "https://langfuse.com/docs/observability/overview.md"
curl -s "https://langfuse.com/docs/observability/overview" -H "Accept: text/markdown"
llms.txt中列出的任何页面都可以通过在路径后追加
.md
或在请求头中设置Accept: text/markdown来获取Markdown格式内容。当你知道所需信息所在的具体页面时使用此方法。返回的内容是整洁的Markdown格式,包含代码示例和配置细节。
bash
curl -s "https://langfuse.com/docs/observability/overview.md"
curl -s "https://langfuse.com/docs/observability/overview" -H "Accept: text/markdown"

2c. Search Documentation

2c. 搜索文档

When you need to find information across all docs and github issues/discussions without knowing the specific page:
bash
curl -s "https://langfuse.com/api/search-docs?query=<url-encoded-query>"
Example:
bash
curl -s "https://langfuse.com/api/search-docs?query=How+do+I+trace+LangGraph+agents"
Returns a JSON response with:
  • query
    : the original query
  • answer
    : a JSON string containing an array of matching documents, each with:
    • url
      : link to the doc page
    • title
      : page title
    • source.content
      : array of relevant text excerpts from the page
Search is a great fallback if you cannot find the relevant pages or need more context. Especially useful when debugging issues as all GitHub Issues and Discussions are also indexed. Responses can be large — extract only the relevant portions.
当你需要在所有文档、GitHub问题/讨论中查找信息,但不知道具体页面时:
bash
curl -s "https://langfuse.com/api/search-docs?query=<url-encoded-query>"
示例:
bash
curl -s "https://langfuse.com/api/search-docs?query=How+do+I+trace+LangGraph+agents"
返回JSON响应,包含:
  • query
    : 原始查询语句
  • answer
    : 一个JSON字符串,包含匹配的文档数组,每个文档包含:
    • url
      : 文档页面链接
    • title
      : 页面标题
    • source.content
      : 页面中相关文本片段的数组
如果无法找到相关页面或需要更多上下文,搜索是很好的备选方案。尤其在调试问题时非常有用,因为所有GitHub问题和讨论也被编入索引。响应内容可能较大——只需提取相关部分即可。

Documentation Workflow

文档使用流程

  1. Start with llms.txt to orient — scan for relevant page titles
  2. Fetch specific pages when you identify the right one
  3. Fall back to search when the topic is unclear and you want more context
  1. llms.txt开始定位——浏览相关页面标题
  2. 当确定正确页面后,获取特定页面内容
  3. 当主题不明确且需要更多上下文时,回退到搜索功能