Skip to content
PluginStats

headroom-ai weekly downloads statistics

By headroomlabs-ai · npm · MCP servers

Compress tool outputs, logs, JSON and chat history before each LLM call. Fewer input tokens, same answers. Adapters for OpenAI, Anthropic, Gemini and the Vercel AI SDK. Runs against the local Headroom proxy (pip install "headroom-ai[proxy]").

View on npm Fresh · Nov 6, 2026

headroom-ai has 32,562 recorded weekly downloads on npm, ranking #868 of 2,865 tracked listings.

Weekly downloads
32,562
Official API · Nov 4, 2026
7-day growth
—
Insufficient history
30-day growth
—
Insufficient history
90-day growth
—
Insufficient history
Rank
#868
Among tracked npm listings

About headroom-ai

Headroom (headroom-ai) for TypeScript

Compress tool outputs, logs, JSON and chat history before each LLM call. Fewer input tokens, same answers.

Requires the Headroom proxy. Compression runs in the Python proxy; this package sends messages to it over HTTP (default http://localhost:8787). Start it first:

pip install "headroom-ai[proxy]"   # or: uv tool install --python 3.13 "headroom-ai[proxy]"
headroom proxy --port 8787

Install

npm install headroom-ai

Quick Start

import { compress } from 'headroom-ai';

const result = await compress(messages, { model: 'gpt-4o' });
console.log(`Saved ${result.tokensSaved} tokens (${((1 - result.compressionRatio) * 100).toFixed(0)}%)`);

// Use compressed messages with any LLM client
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: result.messages,
});

Pass baseUrl if the proxy is not on http://localhost:8787.

Framework Adapters

Vercel AI SDK
import { withHeadroom } from 'headroom-ai/vercel-ai';
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

const model = withHeadroom(openai('gpt-4o'));
const { text } = await generateText({ model, messages });
<details> <summary>Advanced: using middleware directly</summary>
import { headroomMiddleware } from 'headroom-ai/vercel-ai';
import { wrapLanguageModel } from 'ai';

const model = wrapLanguageModel({
  model: openai('gpt-4o'),
  middleware: headroomMiddleware({ baseUrl: 'http://localhost:8787' }),
});
</details>
OpenAI SDK
import { withHeadroom } from 'headroom-ai/openai';
import OpenAI from 'openai';

const client = withHeadroom(new OpenAI());
const response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: longConversation,
});
Anthropic SDK
import { withHeadroom } from 'headroom-ai/anthropic';
import Anthropic from '@anthropic-ai/sdk';

const client = withHeadroom(new Anthropic());
const response = await client.messages.create({
  model: 'claude-sonnet-4-5-20250929',
  messages: longConversation,
  max_tokens: 1024,
});
Google Gemini
import { withHeadroom } from 'headroom-ai/gemini';
import { GoogleGenerativeAI } from '@google/generative-ai';

const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY!);
const model = withHeadroom(genAI.getGenerativeModel({ model: 'gemini-2.0-flash' }));

const result = await model.generateContent({
  contents: longConversation,
});

HeadroomClient

The full client provides direct access to the proxy's OpenAI and Anthropic passthrough endpoints, plus metrics, CCR, and observability.

import { HeadroomClient } from 'headroom-ai';

const client = new HeadroomClient({
  baseUrl: 'http://localhost:8787',
  providerApiKey: process.env.OPENAI_API_KEY,
  config: {
    smartCrusher: { enabled: true, maxItemsAfterCrush: 10 },
    ccr: { enabled: true },
  },
});
Chat Completions (OpenAI-style)
const response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: longConversation,
  headroomMode: 'optimize',
});
Messages (Anthropic-style)
const response = await client.messages.create({
  model: 'claude-sonnet-4-5-20250929',
  messages: longConversation,
  max_tokens: 1024,
  headroomMode: 'optimize',
});
Direct Compression
const result = await client.compress(messages, { model: 'gpt-4o', tokenBudget: 4000 });

Simulation (Dry Run)

See what compression would do without calling the LLM.

import { simulate } from 'headroom-ai';

const sim = await simulate(messages, { model: 'gpt-4o' });
console.log(`Would save ${sim.tokensSaved} tokens (${sim.estimatedSavings})`);
console.log('Transforms:', sim.transforms);
console.log('Waste signals:', sim.wasteSignals);
console.log('Cache alignment:', sim.cacheAlignmentScore);

Also available on the client:

const sim = await client.chat.completions.simulate({
  model: 'gpt-4o',
  messages,
});

Compression Hooks

Customize compression with pre/post hooks — matching the Python CompressionHooks API.

import { compress, CompressionHooks } from 'headroom-ai';
import type { CompressContext, CompressEvent } from 'headroom-ai';

class MyHooks extends CompressionHooks {
  // Modify messages before compression
  preCompress(messages: any[], ctx: CompressContext) {
    return [{ role: 'system', content: 'Always preserve error details.' }, ...messages];
  }

  // Set per-message importance biases
  computeBiases(messages: any[], ctx: CompressContext) {
    return { 0: 2.0 }; // preserve first message
  }

  // Observe compression results
  postCompress(event: CompressEvent) {
    console.log(`Saved ${event.tokensSaved} tokens via ${event.transformsApplied.join(', ')}`);
  }
}

const result = await compress(messages, { model: 'gpt-4o', hooks: new MyHooks() });

SharedContext (Multi-Agent)

Compressed inter-agent context sharing — matching the Python SharedContext API.

import { SharedContext } from 'headroom-ai';

const ctx = new SharedContext({ model: 'gpt-4o', ttl: 3600, maxEntries: 100 });

// Agent A stores data (automatically compressed)
const entry = await ctx.put('research', bigAgentOutput, { agent: 'researcher' });
console.log(`Compressed: ${entry.savingsPercent.toFixed(0)}% savings`);

// Agent B reads it (~80% smaller)
const summary = ctx.get('research');

// Agent B gets original if needed
const full = ctx.get('research', { full: true });

// Stats
const stats = ctx.stats();
console.log(`${stats.entries} entries, ${stats.totalTokensSaved} tokens saved`);

CCR Retrieve (Compress-Cache-Retrieve)

Retrieve original content when the LLM needs full details.

const result = await client.compress(messages, { model: 'gpt-4o' });…

Description from the npm listing.

  • llm
  • openai
  • anthropic
  • gemini
  • vercel-ai-sdk
  • token-cost
  • reduce-tokens
  • input-tokens
  • context-window
  • token-budget
  • tool-output
  • chat-history
  • context-compression
  • prompt-compression
  • agents
  • mcp

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

headroom-ai weekly downloads on npm, last 90 days: 32,562 weekly downloads as of Nov 4, 2026.headroom-aiWeekly downloads on npm · Last 90 days32,562downloads / week29K30K31K32K33K34K35K36KAug 6Aug 21Sep 5Sep 20Oct 5Oct 20Nov 4downloads / weekNov 4, 2026 – Nov 4, 2026 · 1 observations · Updated Nov 4, 2026pluginstats.com
headroom-ai weekly downloads on npm, last 90 days: 32,562 weekly downloads as of Nov 4, 2026.

7/30/90-day growth

headroom-ai weekly downloads growth on npm: 7-day growth unavailable, 30-day growth unavailable, 90-day growth unavailable.headroom-aiWeekly downloads growth on npm32,562downloads / week now7-day growthinsufficient historyInsufficient history30-day growthinsufficient historyInsufficient history90-day growthinsufficient historyInsufficient historyGrowth vs. nearest observation to each baseline date · Updated Nov 4, 2026pluginstats.com
headroom-ai weekly downloads growth on npm: 7-day growth unavailable, 30-day growth unavailable, 90-day growth unavailable.

Ranking history

headroom-ai npm ranking history: currently #868 (by weekly downloads).headroom-ainpm ranking · by weekly downloads · Last 90 days#868current rank#866#867#868#869#870Aug 8Aug 23Sep 7Sep 22Oct 7Oct 22Nov 6rankNov 6, 2026 – Nov 6, 2026 · 1 observations · Updated Nov 4, 2026pluginstats.com
headroom-ai npm ranking history: currently #868 (by weekly downloads).

Listing placement

All npm2,864 listings · 144 pages · 1,434 shown · page 44, #18 (overall #878)
All npm: every listing in weekly downloads order

Listing placement

MCP servers402 listings · 21 pages · page 7, #18 (overall #138)
MCP servers: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (1)
Recent weekly downloads observations for headroom-ai
Date (UTC)Weekly downloadsChange vs. previous
32,562—

Similar npm MCP servers plugins

All 20 headroom-ai alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/headroom-ai. First seen Nov 6, 2026; last successful collection Nov 6, 2026. See the methodology.