Skip to content
PluginStats

prompt-identifiers-ai-sdk weekly downloads statistics

By fogx · npm · AI SDKs

Vercel AI SDK middleware for prompt-identifiers. Efficient ID compression for token optimization.

View on npm Fresh · Oct 18, 2026

prompt-identifiers-ai-sdk has 1,913 recorded weekly downloads on npm, an increase of 1608% over the past 30 days, ranking #1339 of 2,322 tracked listings.

Weekly downloads
1,913
Official API · Oct 18, 2026
7-day growth
-27.2%
-713 weekly downloads
30-day growth
+1608%
+1.8K weekly downloads
90-day growth
+1219%
+1.8K weekly downloads
Rank
#1339
Among tracked npm listings

About prompt-identifiers-ai-sdk

prompt-identifiers-ai-sdk

Vercel AI SDK middleware for automatic ID encoding/decoding in LLM prompts. Reduces token usage by up to 90% for UUIDs and ULIDs.

Installation

npm install prompt-identifiers-ai-sdk prompt-identifiers ai

Requires ai v7 and @ai-sdk/provider v4. On AI SDK v6, stay on prompt-identifiers-ai-sdk@0.2.x.

Quick Start

import { openai } from "@ai-sdk/openai";
import { wrapLanguageModel, generateText } from "ai";
import { promptIdentifiersMiddleware } from "prompt-identifiers-ai-sdk";

// Wrap your model with the middleware
const model = wrapLanguageModel({
  model: openai("gpt-4o"),
  middleware: promptIdentifiersMiddleware({
    config: { inputFormat: "UUID", outputFormat: "SafeNumeric" },
  }),
});

// Use normally - IDs are automatically encoded/decoded
const result = await generateText({
  model,
  prompt: "Summarize activity for user 123e4567-e89b-42d3-a456-426655440000",
});

// The LLM sees: "Summarize activity for user ~000~"
// You receive the response with original UUIDs restored

How It Works

  1. Before LLM call: The middleware encodes IDs in your prompt messages

    • 123e4567-e89b-42d3-a456-426655440000 → ~000~
  2. After LLM call: The middleware decodes IDs in the response

    • ~000~ → 123e4567-e89b-42d3-a456-426655440000

This is completely transparent - you work with real IDs, the LLM works with compact placeholders.

Configuration

promptIdentifiersMiddleware({
  // Required: encoding configuration
  config: {
    inputFormat: "UUID", // or 'ULID' or custom RegExp
    outputFormat: "SafeNumeric", // or 'Numeric', 'IdToken', { template: '...' }
  },

  // Inject a format-preservation instruction into the system message (default: true)
  // Prevents LLMs from stripping delimiter characters in tool call arguments
  injectInstruction: true,

  // Custom instruction text ({format} is replaced with example token like ~000~)
  customInstruction: "IDs use {format} notation. Preserve them exactly.",

  // Optional: enable debug mode for detailed diagnostics
  debug: true,

  // Optional: callbacks for logging/debugging
  onEncode: (result) => {
    console.log("Mapping:", result.mapping);
    if (result.debugData) {
      console.log(
        `Encoded ${result.debugData.encodedCount} IDs in ${result.debugData.durationMs}ms`
      );
    }
  },
  onDecode: (result) => {
    console.log("Decoded output:", result.output);
    // Warnings detect anomalies like stripped delimiters
    if (result.warnings?.length) {
      console.warn("Decode warnings:", result.warnings);
    }
    if (result.debugData) {
      console.log(
        `Decoded ${result.debugData.decodedCount} placeholders in ${result.debugData.durationMs}ms`
      );
    }
  },
});
Input Formats
FormatDescriptionExample
'UUID'RFC 4122 UUIDs123e4567-e89b-42d3-a456-426655440000
'ULID'Crockford Base32 ULIDs01ARZ3NDEKTSV4RRFFQ69G5FAV
RegExpCustom pattern/user-\d{6}/gi
Output Formats
FormatDescriptionExample
'SafeNumeric'Collision-safe with tildes (recommended)~000~, ~001~
'Numeric'Simple numeric with smart triplet expansion000, 001
'IdToken'Base62 encoding0, A, z, 10
{ template: '...' }Custom template{ template: '[ID:{i}]' } → [ID:0]

Streaming Support

Important: For streaming responses, use a delimited format like SafeNumeric or a custom template with delimiters. Non-delimited formats (Numeric, IdToken) cannot reliably handle placeholders split across chunks.

The middleware buffers incomplete placeholders when using delimited formats like SafeNumeric:

import { streamText } from "ai";

const result = await streamText({
  model, // wrapped model
  prompt: "Analyze user 123e4567-e89b-42d3-a456-426655440000",
});

for await (const chunk of result.textStream) {
  // IDs are decoded in real-time as the stream arrives
  console.log(chunk);
}

Works With Any Provider

The middleware works with any AI SDK provider:

import { anthropic } from "@ai-sdk/anthropic";
import { google } from "@ai-sdk/google";
import { mistral } from "@ai-sdk/mistral";

// Anthropic
const claudeModel = wrapLanguageModel({
  model: anthropic("claude-3-5-sonnet-20241022"),
  middleware: promptIdentifiersMiddleware({ config }),
});

// Google
const geminiModel = wrapLanguageModel({
  model: google("gemini-1.5-pro"),
  middleware: promptIdentifiersMiddleware({ config }),
});

Multiple IDs

Duplicate IDs are automatically deduplicated:

const prompt = `
  User 123e4567-e89b-42d3-a456-426655440000 sent a message.
  Check if 123e4567-e89b-42d3-a456-426655440000 is online.
  User 987fcdeb-51a2-43f7-8d9c-0123456789ab received it.
`;

// Encoded as:
// User ~000~ sent a message.
// Check if ~000~ is online.
// User ~001~ received it.

License

MIT

Description from the npm listing.

  • llm
  • ai
  • vercel
  • ai-sdk
  • middleware
  • tokens
  • compression
  • prompt
  • uuid
  • ulid

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

prompt-identifiers-ai-sdk weekly downloads on npm, last 90 days: 1,913 weekly downloads as of Oct 18, 2026, +1219% over 90 days.prompt-identifiers-ai-sdkWeekly downloads on npm · Last 90 days1,913downloads / week+1219% over 90 days05001K1.5K2K2.5K3KJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
prompt-identifiers-ai-sdk weekly downloads on npm, last 90 days: 1,913 weekly downloads as of Oct 18, 2026, +1219% over 90 days.

7/30/90-day growth

prompt-identifiers-ai-sdk weekly downloads growth on npm: -27.2% over 7 days, +1608% over 30 days, +1219% over 90 days.prompt-identifiers-ai-sdkWeekly downloads growth on npm1,913downloads / week now7-day growth-713 weekly downloads-27.2%30-day growth+1,801 weekly downloads+1608%90-day growth+1,768 weekly downloads+1219%Growth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
prompt-identifiers-ai-sdk weekly downloads growth on npm: -27.2% over 7 days, +1608% over 30 days, +1219% over 90 days.

Ranking history

prompt-identifiers-ai-sdk npm ranking history: currently #1339 (by weekly downloads).prompt-identifiers-ai-sdknpm ranking · by weekly downloads · Last 90 days#1339current rank#1334#1335#1336#1337#1338#1339#1340#1341Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 18, 2026 – Oct 20, 2026 · 3 observations · Updated Oct 18, 2026pluginstats.com
prompt-identifiers-ai-sdk npm ranking history: currently #1339 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,162 shown · page 68, #2 (overall #1,342)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs259 listings · 13 pages · page 6, #9 (overall #109)
AI SDKs: 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 (122)
Recent weekly downloads observations for prompt-identifiers-ai-sdk
Date (UTC)Weekly downloadsChange vs. previous
1,913+526
1,387-67
1,454+106
1,348-819
2,167-715
2,8820
2,882+256
2,626+39
2,587+10
2,577+354
2,223+560
1,663+689
974-44
1,018—

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/prompt-identifiers-ai-sdk. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.