langfuse
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLangfuse
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 to interact with the full Langfuse REST API from the command line. Run via npx (no install required):
langfuse-clibash
npx langfuse-cli api <resource> <action>使用从命令行与完整的Langfuse REST API进行交互。通过npx运行(无需安装):
langfuse-clibash
npx langfuse-cli api <resource> <action>Quick Start
快速开始
bash
undefinedbash
undefinedDiscover 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
undefinednpx langfuse-cli api <resource> <action> --help
undefinedCredentials
凭证
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 EUIf not set, ask the user for their API keys (found in Langfuse UI → Settings → API Keys) and which host they use (, , or self-hosted URL).
cloud.langfuse.comus.cloud.langfuse.com在调用前设置环境变量:
bash
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_HOST=https://cloud.langfuse.com # 可选,默认是欧洲节点如果未设置,需向用户询问其API密钥(可在Langfuse UI → 设置 → API密钥中找到)以及使用的主机地址(、或自托管URL)。
cloud.langfuse.comus.cloud.langfuse.comDetailed 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.txtReturns 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 and explore the site to find the page you need.
https://langfuse.com/docs获取所有文档页面的完整索引:
bash
curl -s https://langfuse.com/llms.txt返回包含所有文档页面标题和URL的结构化列表。使用此索引查找对应主题的页面,然后直接获取该页面内容。
或者,你也可以从开始浏览站点以找到所需页面。
https://langfuse.com/docs2b. Fetch Individual Pages as Markdown
2b. 获取单个页面的Markdown版本
Any page listed in llms.txt can be fetched as markdown by appending 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.
.mdbash
curl -s "https://langfuse.com/docs/observability/overview.md"
curl -s "https://langfuse.com/docs/observability/overview" -H "Accept: text/markdown"llms.txt中列出的任何页面都可以通过在路径后追加或在请求头中设置Accept: text/markdown来获取Markdown格式内容。当你知道所需信息所在的具体页面时使用此方法。返回的内容是整洁的Markdown格式,包含代码示例和配置细节。
.mdbash
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:
- : the original query
query - : a JSON string containing an array of matching documents, each with:
answer- : link to the doc page
url - : page title
title - : array of relevant text excerpts from the page
source.content
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 - : 一个JSON字符串,包含匹配的文档数组,每个文档包含:
answer- : 文档页面链接
url - : 页面标题
title - : 页面中相关文本片段的数组
source.content
如果无法找到相关页面或需要更多上下文,搜索是很好的备选方案。尤其在调试问题时非常有用,因为所有GitHub问题和讨论也被编入索引。响应内容可能较大——只需提取相关部分即可。
Documentation Workflow
文档使用流程
- Start with llms.txt to orient — scan for relevant page titles
- Fetch specific pages when you identify the right one
- Fall back to search when the topic is unclear and you want more context
- 从llms.txt开始定位——浏览相关页面标题
- 当确定正确页面后,获取特定页面内容
- 当主题不明确且需要更多上下文时,回退到搜索功能