npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@launchdarkly/ai-node

v0.2.0

Published

Node.js convenience wrapper for @launchdarkly/ai-server — bundles @launchdarkly/node-server-sdk so no peer dependency setup is required

Downloads

594

Readme

@launchdarkly/ai-node

Node.js convenience wrapper for the LaunchDarkly AI SDK.

This package re-exports the full public API of @launchdarkly/ai-server and carries @launchdarkly/node-server-sdk as a hard dependency. For standard Node.js applications, installing this single package is all that is needed — no peer dependency wiring required.

When to use this package

| Runtime | Install | |---|---| | Node.js (server, Lambda, containers) | @launchdarkly/ai-node ← this package | | Edge runtimes (Vercel, Cloudflare, etc.) | @launchdarkly/ai-server directly, then call initClient(preInitializedClient) |

Installation

npm install @launchdarkly/ai-node

Add whichever handler package(s) your application uses:

npm install @launchdarkly/ai-openai-messages
# or
npm install @launchdarkly/ai-claude-agents
# etc.

Optionally, install @launchdarkly/ai-otel to enable trace export to the LaunchDarkly Observability dashboard:

npm install @launchdarkly/ai-otel

initClient() detects the OTel packages at runtime and configures tracing automatically. If they are absent, a single console.warn is emitted and all AI calls continue normally with no-op spans.

Usage

Import from @launchdarkly/ai-node exactly as you would from @launchdarkly/ai-server — the API surface is identical.

import 'dotenv/config';
import { config, shutdown } from '@launchdarkly/ai-node';
import { createOpenAIHandler } from '@launchdarkly/ai-openai-messages';

const caller = config({
  key: 'my-ai-config-flag',
  handler: createOpenAIHandler(),
});

const result = await caller.invoke(
  'What is feature flagging?',
  { kind: 'user', key: 'user-123' },
);

console.log(result.response);
await shutdown();

@launchdarkly/node-server-sdk is auto-discovered by initClient() via dynamic import. The LD_SDK_KEY environment variable is read automatically — no explicit initClient() call is required unless you need programmatic options or early startup initialization.

Environment variables

| Variable | Required | Description | |---|---|---| | LD_SDK_KEY | Yes | LaunchDarkly server-side SDK key | | LD_BASE_URI | No | Override the LaunchDarkly polling base URI | | LD_STREAM_URI | No | Override the streaming URI | | LD_EVENTS_URI | No | Override the events URI | | LD_SERVICE_NAME | No | OTel service.name resource attribute (default: nodejs-sdk) | | LD_ENVIRONMENT | No | deployment.environment attribute attached to telemetry | | OTEL_EXPORTER_OTLP_ENDPOINT | No | OTLP endpoint override (default: LaunchDarkly Observability backend) |

inspectConfig(key, context)

Reads an AI Config flag variation without invoking any AI provider. Re-exported from @launchdarkly/ai-server — see the full reference there.

import { inspectConfig } from '@launchdarkly/ai-node';

const result = await inspectConfig('my-ai-config-flag', { kind: 'user', key: 'user-123' });
if (result.enabled) {
  console.log(result.config?.model?.name);
}

Never throws. Returns { enabled: boolean, config: AiConfigRep | null, meta: VariationMeta | null }.

Full API reference

See @launchdarkly/ai-server — all exports are re-exported unchanged from this package.