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

fortress-optimizer

v1.0.1

Published

Cut your LLM API costs by 10-20%. Drop-in prompt optimization for OpenAI, Anthropic, Gemini, and more.

Downloads

278

Readme

fortress-optimizer

Cut your LLM API costs by 10-20%. Drop-in prompt optimization for OpenAI, Anthropic, Gemini, and more.

npm install fortress-optimizer

3-Line Quick Start

const { FortressClient } = require('fortress-optimizer');

const client = new FortressClient(process.env.FORTRESS_API_KEY);
const result = await client.optimize('Can you please help me write a detailed and comprehensive analysis of this data and provide insights');

console.log(result.optimization.optimized_prompt);
// → "Write a detailed analysis of this data and provide insights"

console.log(`${result.tokens.savings_percentage}% fewer tokens`);
// → "18% fewer tokens"

50,000 tokens/month free. No credit card required. Get a key at fortress-optimizer.com

Why?

Every token you send to GPT-4, Claude, or Gemini costs money. Most prompts contain filler words, redundant phrases, and unnecessary politeness that inflate token counts without improving results.

Fortress compresses your prompts server-side before they reach the model — same meaning, fewer tokens, lower cost.

Real Savings

| Level | Savings | Best For | |-------|---------|----------| | conservative | ~5% | Production prompts where every word matters | | balanced | ~15% | General use (default) | | aggressive | ~20% | Cost-sensitive batch processing |

Full API

const client = new FortressClient('fk_your_key', {
  baseUrl: 'https://api.fortress-optimizer.com',  // default
  timeout: 10000,                                  // default
});

// Optimize a prompt
const result = await client.optimize(prompt, 'balanced', 'openai');
// result.optimization.optimized_prompt — the optimized text
// result.tokens.original — original token count
// result.tokens.optimized — optimized token count
// result.tokens.savings — tokens saved
// result.tokens.savings_percentage — percentage saved

// Check your usage
const usage = await client.getUsage();
// usage.tokens_remaining, usage.tier, usage.reset_date

// List supported providers
const providers = await client.getProviders();

// Health check
const isUp = await client.healthCheck();

Batch Optimization

const prompts = [
  'Please analyze this data and provide your insights',
  'Can you help me understand what this code does in detail',
  'I would like you to summarize the key points of this document',
];

const results = await Promise.all(
  prompts.map(p => client.optimize(p, 'balanced', 'openai'))
);

const totalSaved = results.reduce((sum, r) => sum + r.tokens.savings, 0);
console.log(`Saved ${totalSaved} tokens across ${results.length} prompts`);

Error Handling

try {
  const result = await client.optimize(prompt, 'balanced', 'openai');
} catch (error) {
  if (error.response?.status === 429) {
    console.log('Rate limited — wait before retrying');
  } else if (error.response?.status === 401) {
    console.log('Invalid API key');
  }
}

Providers

OpenAI, Anthropic, Azure, Google Gemini, Groq, Ollama — pass the provider name and the optimizer tailors compression to each tokenizer.

Pricing

| Plan | Price | Tokens | |------|-------|--------| | Free | $0 | 50,000/month | | Pro | $15/month | Unlimited | | Teams | From $60/month | Unlimited + team management | | Enterprise | Custom | Dedicated support + SLAs |

Links

License

MIT