🪢 Langfuse JS/TS SDKs - Instrument your LLM app and get detailed tracing/observability. Works with any LLM or framework https://langfuse.com/docs/sdk/typescript
  • TypeScript 99.4%
  • JavaScript 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
langfuse-bot 74f7eb1173
feat(api): update API spec from langfuse/langfuse 618aac2 (#1078)
Co-authored-by: langfuse-bot <langfuse-bot@langfuse.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-11-02 16:38:22 +01:00
.github ci(deps): bump the github-actions group with 4 updates (#1073) 2026-10-30 08:56:20 +01:00
.husky chore: add turbo to precommit hooks 2026-03-09 18:23:04 +01:00
packages feat(api): update API spec from langfuse/langfuse 618aac2 (#1078) 2026-11-02 16:38:22 +01:00
scripts ci(release): upgrade to pnpm 12 and stage npm packages for 2FA approval (#1048) 2026-10-22 10:04:07 +04:00
tests feat(api): update API spec from langfuse/langfuse 618aac2 (#1078) 2026-11-02 16:38:22 +01:00
.env.example ci(deps): bump the github-actions group with 2 updates (#808) 2026-05-22 13:32:08 +02:00
.gitignore chore: improve codex agent setup (#797) 2026-04-27 14:57:38 +09:00
.prettierignore feat!: prepare v6 release (#1022) 2026-10-14 14:45:40 +04:00
.release-it.ci.json ci(release): push releases with a short-lived GitHub App token (#1049) 2026-10-22 16:40:28 +04:00
.release-it.json fix(ci): inlined package version 2026-03-13 13:47:35 +01:00
AGENTS.md feat!: prepare v6 release (#1022) 2026-10-14 14:45:40 +04:00
CONTRIBUTING.md ci(release): upgrade to pnpm 12 and stage npm packages for 2FA approval (#1048) 2026-10-22 10:04:07 +04:00
eslint.config.mjs feat(skills): add skill availability tracing (#1013) 2026-10-28 16:39:37 +01:00
LICENSE chore: use the standard MIT layout in LICENSE (#960) 2026-10-22 10:11:01 +04:00
package.json chore: release v6.1.1 2026-11-02 09:56:47 +00:00
pnpm-lock.yaml fix(otel): keep OTLP exporter peers on the OpenTelemetry SDK 2.x line (#1077) 2026-11-02 09:39:39 +00:00
pnpm-workspace.yaml chore(deps-dev): bump autoevals to 0.4.1 and drop zod 3 (#1068) 2026-10-27 13:41:35 +01:00
README.md fix(otel): keep OTLP exporter peers on the OpenTelemetry SDK 2.x line (#1077) 2026-11-02 09:39:39 +00:00
tsconfig.base.json feat!: prepare v6 release (#1022) 2026-10-14 14:45:40 +04:00
tsconfig.json feat(vercel-ai-sdk): add AI SDK v7 integration (#794) 2026-06-26 16:46:07 +02:00
turbo.json feat!: prepare v6 release (#1022) 2026-10-14 14:45:40 +04:00
typedoc.config.cjs fix(docs): repair the LICENSE links and add a canonical URL to the reference site (#937) 2026-09-04 10:38:20 +02:00
vitest.config.ts feat(vercel-ai-sdk): add AI SDK v7 integration (#794) 2026-06-26 16:46:07 +02:00
vitest.setup.ts ci(deps): bump the github-actions group with 2 updates (#808) 2026-05-22 13:32:08 +02:00
vitest.workspace.ts ci: skip provider-backed e2e tests on fork pull requests (#1045) 2026-10-21 19:35:46 +04:00

hero-b

langfuse-js

MIT License CI test status GitHub Repo stars Discord YC W23

Modular mono repo for the Langfuse JS/TS client libraries.

Packages

Important

The SDK was rewritten in v5 and released in March 2026. Refer to the v5 migration guide for instructions on updating your code.

langfuse on npm is not the latest Langfuse JS/TS SDK. The unscoped packages langfuse, langfuse-core, langfuse-node, and langfuse-langchain are the deprecated v3 client (new Langfuse(), trace(), span(), api.traceList). Do not npm install langfuse for new instrumentation.

Latest install: npm install @langfuse/tracing @langfuse/otel "@opentelemetry/sdk-node@<0.300" (OpenTelemetry JS SDK 2.x; SDK 3.x is not supported yet). Use @langfuse/tracing (startActiveObservation / startObservation) + LangfuseSpanProcessor from @langfuse/otel. Prompts/datasets/scores: @langfuse/client. Docs: https://langfuse.com/docs/observability/sdk/overview — Upgrade: v3 → v4, v4 → v5, v5 → v6.

Server compatibility: v6 requires Langfuse Cloud or self-hosted Langfuse v4.59.0 or later. On older self-hosted servers, stay on v5.

Query traces with Observations API v2 (GET /api/public/v2/observations, API reference), not GET /api/public/traces / api.traceList.

Data freshness: the only real-time path is OpenTelemetry ingestion (@langfuse/otel, or any OTel exporter sending x-langfuse-ingestion-version: 4) combined with the Observations API v2 and Metrics API v2. All other GET APIs from all SDK packages can be up to 10 minutes behind.

Package NPM Description Environments
@langfuse/client NPM Langfuse API client for universal JavaScript environments Universal JS
@langfuse/browser NPM Langfuse browser SDK for public-key score ingestion Browser
@langfuse/tracing NPM Langfuse instrumentation methods based on OpenTelemetry Node.js 22+
@langfuse/otel NPM Langfuse OpenTelemetry export helpers Node.js 22+
@langfuse/openai NPM Langfuse integration for OpenAI SDK Universal JS
@langfuse/langchain NPM Langfuse integration for LangChain Universal JS
@langfuse/vercel-ai-sdk NPM Langfuse integration for AI SDK v7 Universal JS

Documentation

Development

This is a monorepo managed with pnpm. See CONTRIBUTING.md for detailed development instructions.

Quick start:

pnpm install    # Install dependencies
pnpm build      # Build all packages
pnpm test       # Run tests
pnpm ci         # Run full CI suite

License

MIT

Portions of this codebase are derived from posthog/posthog-js-lite by PostHog, which is also licensed under the MIT License.