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

@anyway-sh/node-server-sdk

v0.22.12

Published

Anyway Software Development Kit (SDK) for Node.js

Readme

@anyway-sh/node-server-sdk

OpenTelemetry-based observability SDK for LLM applications. Automatically instruments LLM provider calls, tracks token usage, and calculates costs.

Installation

npm install @anyway-sh/node-server-sdk

Quick Start

import { initialize } from "@anyway-sh/node-server-sdk";

initialize({
  apiKey: process.env.ANYWAY_API_KEY,
  appName: "my-app",
});

ESM / Next.js

ESM projects must pass provider modules explicitly since OpenTelemetry's require-based instrumentation doesn't work with ESM imports:

import { initialize } from "@anyway-sh/node-server-sdk";
import * as OpenAIModule from "openai";

initialize({
  apiKey: process.env.ANYWAY_API_KEY,
  appName: "my-app",
  instrumentModules: {
    openAI: OpenAIModule.OpenAI,
  },
});

Tracing Workflows

Use withWorkflow, withTask, withAgent, and withTool to create structured trace hierarchies:

import { withWorkflow, withTask } from "@anyway-sh/node-server-sdk";

async function main() {
  await withWorkflow({ name: "my-pipeline" }, async () => {
    const result = await withTask({ name: "generate-response" }, async () => {
      return openai.chat.completions.create({
        model: "gpt-4",
        messages: [{ role: "user", content: "Hello" }],
      });
    });
    return result;
  });
}

Class Decorators

import { workflow, task } from "@anyway-sh/node-server-sdk";

class MyPipeline {
  @workflow({ name: "run" })
  async run() {
    return this.step();
  }

  @task({ name: "step" })
  async step() {
    // ...
  }
}

Association Properties

Attach metadata to traces for filtering and grouping:

await withWorkflow(
  {
    name: "chat",
    associationProperties: { userId: "user-123", sessionId: "abc" },
  },
  async () => {
    // All spans in this workflow will carry these properties
  },
);

Configuration

Key options for initialize():

| Option | Default | Description | |--------|---------|-------------| | apiKey | ANYWAY_API_KEY env var | API key for sending traces | | appName | npm_package_name | Application name in traces | | baseUrl | ANYWAY_BASE_URL or https://api.traceloop.com | Trace collector endpoint | | disableBatch | false | Send spans immediately (for local dev) | | exporter | OTLP exporter | Custom OpenTelemetry SpanExporter | | processor | BatchSpanProcessor | Custom OpenTelemetry SpanProcessor | | instrumentModules | — | Explicit module references for ESM projects | | pricingEnabled | true | Calculate and attach cost attributes to spans | | pricingJsonPath | — | Path to custom pricing JSON file | | tracingEnabled | true | Enable/disable tracing entirely | | silenceInitializationMessage | false | Suppress startup console message |

Supported Providers

LLM providers and vector databases instrumented automatically:

  • OpenAI — chat completions, embeddings
  • Anthropic — messages
  • AWS Bedrock — invoke model
  • Google Vertex AI — generative models
  • Cohere — chat, embed, rerank
  • Together AI — chat completions
  • LangChain — chains, agents, tools
  • LlamaIndex — query engines, retrievers
  • Pinecone — vector operations
  • ChromaDB — collections, queries
  • Qdrant — points, search
  • MCP — Model Context Protocol client calls

Pricing

Cost calculation is enabled by default. The SDK matches model names from spans against bundled pricing data and sets these attributes:

  • gen_ai.usage.input_cost
  • gen_ai.usage.output_cost
  • gen_ai.usage.cost

To use custom pricing data:

initialize({
  pricingJsonPath: "./my-pricing.json",
});

To disable:

initialize({
  pricingEnabled: false,
});

License

Apache-2.0