Skip to main content
The @vouch-ai/sdk package wires OpenLLMetry auto-instrumentation into every LLM client running in your Node.js process — OpenAI, Anthropic, LangChain, Bedrock, LlamaIndex, and more — and ships the resulting OpenTelemetry spans to your Trident project at app.usetrident.dev. PII redaction runs entirely inside your process before any trace data leaves, so emails, API keys, credit card numbers, and other sensitive values are scrubbed at the edge, never in transit.

Requirements

  • Node.js 20 or later (the SDK is published as native ESM)
  • npm, yarn, or pnpm

Install

Set your environment variables

Open your project’s .env file (or your deployment platform’s secrets manager) and add the keys from your project’s Settings → API Keys page at app.usetrident.dev:
.env
The SDK also accepts the legacy VOUCH_PROJECT_PUBLIC_KEY / VOUCH_PROJECT_SECRET_KEY names for backwards compatibility.

Initialize Trident

Call trident.init() once, at the very top of your application entry point, before you import or instantiate any LLM client. Every LLM call made after init() is automatically traced.
When projectPk and projectSk are omitted, init() reads them from TRIDENT_PROJECT_PUBLIC_KEY / TRIDENT_PROJECT_SECRET_KEY automatically, so the call can be reduced to a bare trident.init() if you prefer to keep credentials only in the environment.

All options

Full working example

The snippet below starts Trident tracing, then makes a standard OpenAI chat completion. The completion call is traced automatically — no wrapping or middleware required.

Zero-code option (no source changes)

If you want Trident traces without touching your source code, use the @vouch-ai/sdk/register module with Node’s --import flag. The module reads your credentials from environment variables and calls init() automatically before your application starts.
The register module is a silent no-op if TRIDENT_PROJECT_PUBLIC_KEY or TRIDENT_PROJECT_SECRET_KEY are not set — it never throws and never breaks your app. In non-production environments it prints a warning to help you catch misconfigurations early.

Supported LLM frameworks

The SDK auto-instruments all of the following when they are loaded in the same process:

OpenAI

Anthropic

LangChain

CrewAI

LlamaIndex

Amazon Bedrock

Google VertexAI

Cohere

MCP (Model Context Protocol)

OpenAI Agents SDK

No code changes are required in your LLM client calls. Instrumentation attaches at the module level as soon as init() runs.
PII redaction is on by default. Before any span attribute leaves your process, the SDK scans it for and replaces the following patterns with [REDACTED_<TYPE>] tokens:
  • EMAIL — email addresses
  • CREDIT_CARD — card numbers (Luhn-validated to avoid false positives)
  • SSN — US Social Security Numbers (XXX-XX-XXXX)
  • AWS_KEY — AWS access key IDs (AKIA…, ASIA…)
  • JWT — JSON Web Tokens
  • API_KEY — API keys (sk-…, sk-ant-…)
  • IBAN — International Bank Account Numbers
  • IP — IPv4 addresses
  • PHONE — phone numbers
Pass redactPII: false to init() to disable, or redactPII: { rules: [...] } to supply your own rule set.

Next steps

TypeScript SDK API Reference

Explore the full API: trident.init(), trident.scan(), trident.selfReport(), and all configuration options.