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

@stewrd/sdk

v0.1.3

Published

Dead-simple prompt versioning and A/B testing SDK for Anthropic and OpenAI

Readme

@stewrd/sdk

Dead-simple prompt versioning and A/B testing for Anthropic and OpenAI.

npm version License: MIT

Installation

npm install @stewrd/sdk
# or
pnpm add @stewrd/sdk
# or
yarn add @stewrd/sdk

Quick Start

import { PromptSDK } from '@stewrd/sdk';

const sdk = new PromptSDK({ apiKey: 'your-stewrd-api-key' });

// Simple usage - version tracking
const response = await sdk.run('user-onboarding-v2', {
  model: 'claude-sonnet-4-5',
  input: 'Hello! I need help getting started.',
});

console.log(response.content);

A/B Testing

Split traffic between prompt variants and measure real performance:

const response = await sdk.run('user-onboarding', {
  model: 'claude-sonnet-4-5',
  input: userMessage,
  variants: {
    'control': {
      weight: 50,
      systemMessage: 'You are a friendly onboarding assistant.',
    },
    'experiment': {
      weight: 50,
      systemMessage: 'You are a concise onboarding expert.',
    },
  },
});

console.log(`Used variant: ${response.variant}`);
console.log(response.content);

Features

  • Prompt Versioning - Track every prompt change, roll back when needed
  • A/B Testing - Split traffic between variants, measure real performance
  • Multi-Provider - Works with Anthropic (Claude) and OpenAI (GPT)
  • Usage Analytics - Token usage, latency, cost tracking per variant
  • TypeScript First - Fully typed with great DX
  • Retry Logic - Built-in exponential backoff for reliability
  • Lightweight - Minimal dependencies, fast startup

Configuration

const sdk = new PromptSDK({
  apiKey: 'sk_...', // Required: Your stewrd API key
  baseUrl: 'https://api.stewrd.dev', // Optional: API endpoint
  debug: false, // Optional: Enable debug logging
  timeout: 30000, // Optional: Request timeout in ms
  retry: {
    maxRetries: 3, // Optional: Max retry attempts
    baseDelay: 1000, // Optional: Initial retry delay
    maxDelay: 10000, // Optional: Max retry delay
    exponentialBackoff: true, // Optional: Use exponential backoff
  },
});

API Reference

sdk.run(promptName, options)

Execute a prompt with optional versioning and A/B testing.

Parameters:

| Option | Type | Required | Description | |--------|------|----------|-------------| | model | string | Yes | Model identifier (e.g., 'claude-sonnet-4-5', 'gpt-4o') | | input | string | Yes | User message/input | | systemMessage | string | No | System prompt | | variants | object | No | A/B testing configuration | | parameters | object | No | Model parameters (temperature, max_tokens, etc.) | | metadata | object | No | Custom metadata to attach |

Response:

interface PromptResponse {
  content: string; // Generated response text
  variant?: string; // Selected variant (if A/B testing)
  provider: 'anthropic' | 'openai'; // Provider used
  model: string; // Model that was used
  usage?: {
    inputTokens: number;
    outputTokens: number;
    totalTokens: number;
  };
  latencyMs: number; // Response time in milliseconds
  runId?: string; // Unique run identifier
}

sdk.getAnalytics(promptName, options?)

Fetch analytics for a prompt.

const analytics = await sdk.getAnalytics('user-onboarding', {
  startDate: new Date('2024-01-01'),
  endDate: new Date(),
  variant: 'experiment', // Optional: filter by variant
});

Supported Models

Anthropic:

  • claude-opus-4-5 / claude-opus-4-5-20251101
  • claude-sonnet-4-5 / claude-sonnet-4-5-20251101
  • claude-3-5-sonnet / claude-3-5-sonnet-20241022
  • claude-3-5-haiku / claude-3-5-haiku-20241022

OpenAI:

  • gpt-4o / gpt-4o-2024-08-06
  • gpt-4o-mini
  • gpt-4-turbo
  • gpt-3.5-turbo

Environment Variables

For local development, set your provider API keys:

ANTHROPIC_API_KEY=your-anthropic-key
OPENAI_API_KEY=your-openai-key

TypeScript Support

Fully typed with TypeScript. Import types as needed:

import type {
  PromptSDK,
  PromptSDKConfig,
  PromptResponse,
  RunOptions,
  PromptVariant,
  RetryConfig,
} from '@stewrd/sdk';

Links

License

MIT - see LICENSE for details.