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

@montage-sh/sdk

v0.1.0

Published

Official SDK for Montage - Remote configuration for AI prompts

Readme

@montage-sh/sdk

Official SDK for Montage - Remote configuration for AI prompts.

Installation

npm install @montage-sh/sdk

Quick Start

import { Montage } from '@montage-sh/sdk';
import OpenAI from 'openai';

// Initialize Montage
const montage = new Montage({
  apiKey: process.env.MONTAGE_API_KEY // mt_live_xxx
});

// Initialize OpenAI
const openai = new OpenAI();

// Fetch your prompt
const prompt = await montage.get('customer-support');

// Use directly with OpenAI — messages are already in the right format
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  temperature: prompt.temperature ?? 0.7,
  messages: prompt.messages
});

With variables

const prompt = await montage.get('customer-support');

// Replace {{variable}} placeholders with actual values
const compiled = prompt.compile({
  user_name: 'Sarah',
  company: 'Acme Corp'
});

const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  temperature: compiled.temperature ?? 0.7,
  messages: compiled.messages
});

API

new Montage(config)

Create a new Montage client.

const montage = new Montage({
  apiKey: 'mt_live_xxx',     // Required
  baseUrl: 'https://...',    // Optional, for self-hosted
  cacheTtl: 60               // Optional, cache TTL in seconds
});

montage.get(slug, options?)

Fetch a prompt by its slug.

const prompt = await montage.get('my-prompt');

// Skip cache
const fresh = await montage.get('my-prompt', { skipCache: true });

// Custom cache TTL
const prompt = await montage.get('my-prompt', { cacheTtl: 300 });

Returns a Prompt object:

{
  id: string;
  slug: string;
  name: string;
  messages: PromptMessage[];     // Array of { role, content } messages
  variables: string[];           // Extracted variable names from {{variable}} syntax
  temperature: number | null;    // e.g., 0.7
  max_tokens: number | null;
  version: number;               // Current published version
  variable_metadata?: Record<string, VariableMetadata>;

  compile(values?: Record<string, string | number | boolean>): CompiledPrompt;
}

prompt.compile(values?)

Replace {{variable}} placeholders in messages with actual values.

const compiled = prompt.compile({ name: 'Sarah' });
// compiled.messages  — messages with variables replaced
// compiled.temperature
// compiled.max_tokens

montage.clearCache()

Clear all cached prompts.

montage.invalidate(slug)

Invalidate a specific prompt from cache.

Error Handling

import { MontageError } from '@montage-sh/sdk';

try {
  const prompt = await montage.get('my-prompt');
} catch (error) {
  if (error instanceof MontageError) {
    console.error(`Error ${error.code}: ${error.message}`);
    // error.status - HTTP status code
    // error.code - Error code (e.g., 'not_found', 'unauthorized')
  }
}

Environment Variables

We recommend storing your API key in an environment variable:

MONTAGE_API_KEY=mt_live_xxxxx
const montage = new Montage({
  apiKey: process.env.MONTAGE_API_KEY!
});

Requirements

  • Node.js 18 or later
  • A Montage API key (mt_live_* or mt_test_*)

License

MIT