LangSmith 会为自托管安装自动生成并同步组织使用量图表。
这些图表可在以下位置查看 Settings > Usage and billing > Usage graph:
- * 按工作区使用量:按工作区统计追踪(根运行)
- * 组织使用量:统计组织的所有追踪(根运行)
图表每 5 分钟刷新一次以包含所有新工作区。请注意,图表不可编辑。
以编程方式获取追踪计数
您可以使用两种不同的方法以编程方式获取追踪计数:
方法 1:使用 LangSmith REST API
如果您的自托管安装使用在线密钥,您可以使用 LangSmith REST API 来获取组织使用量数据。
curl -X GET "https://your-langsmith-instance.com/api/v1/orgs/current/billing/usage" \
-H "Accept: application/json" \
-H "X-API-Key: your-api-key" \
-G \
-d "starting_on=2025-09-01T00:00:00Z" \
-d "ending_before=2025-10-01T00:00:00Z" \
-d "on_current_plan=true"
方法 2:使用 PostgreSQL 支持查询
对于使用离线密钥或需要更详细导出功能的安装,您可以直接对 PostgreSQL 数据库运行支持查询。所有可用脚本位于 支持查询仓库.
sh run_support_query_pg.sh "postgres://postgres:postgres@localhost:5432/postgres" \
--input support_queries/pg_get_trace_counts_daily.sql \
--output trace_counts.csv
有关运行支持查询的更多详细信息,请参阅 对 PostgreSQL 运行支持查询 guide.