Skip to content
PluginStats

@ai-sdk-tools/cache weekly downloads statistics

By ai-sdk-tools (5 listings) · npm · AI SDKs

Simple caching wrapper for AI SDK tools - cache expensive tool executions with zero configuration

View on npm Fresh · Dec 6, 2026

@ai-sdk-tools/cache has 4,244 recorded weekly downloads on npm, a decrease of 4.6% over the past 30 days, ranking #1597 of 3,247 tracked listings.

Weekly downloads
4,244
Official API · Dec 5, 2026
7-day growth
-7.4%
-339 weekly downloads
30-day growth
-4.6%
-205 weekly downloads
90-day growth
+11.8%
+447 weekly downloads
Rank
#1597
▼ 75 in 7 days

About @ai-sdk-tools/cache

@ai-sdk-tools/cache

npm version

Universal caching wrapper for AI SDK tools. Cache expensive tool executions with zero configuration - works with regular tools, streaming tools, and artifacts.

Why Cache Tools?

AI agents repeatedly call expensive tools:

  • Same API calls across conversation turns (weather, translations)
  • Heavy calculations with identical parameters (financial analysis)
  • Database queries that don't change (user profiles, company data)
  • Streaming tools with complex artifact data (charts, metrics)

Caching provides:

  • 10x faster responses for repeated requests
  • 80% cost reduction by avoiding duplicate calls
  • Smooth agent conversations with instant cached results
  • Complete data preservation - streaming, artifacts, everything

Installation

npm install @ai-sdk-tools/cache
# or
bun add @ai-sdk-tools/cache

Quick Start

Basic Usage (LRU Cache)
import { tool } from 'ai';
import { createCached } from '@ai-sdk-tools/cache';
import { z } from 'zod';

// Your expensive tool
const expensiveWeatherTool = tool({
  description: 'Get weather data from API',
  parameters: z.object({
    location: z.string(),
  }),
  execute: async ({ location }) => {
    // Expensive API call
    const response = await fetch(`https://api.weather.com/v1/current?location=${location}`);
    return response.json();
  },
});

// Create cached function (uses LRU by default)
const cached = createCached();

// Wrap with caching - that's it! 🎉
const weatherTool = cached(expensiveWeatherTool);

// Use normally with AI SDK
const result = await generateText({
  model: openai('gpt-4o'),
  tools: { weather: weatherTool },
  messages: [{ role: 'user', content: 'Weather in NYC?' }],
});

Result: First call hits the API, subsequent calls return instantly from cache!

Redis/Upstash Cache (Production)
import { Redis } from "@upstash/redis";
import { createCached } from '@ai-sdk-tools/cache';

// Just pass your Redis client!
const cached = createCached({
  cache: Redis.fromEnv(), // That's it!
  ttl: 30 * 60 * 1000, // 30 minutes
});

const weatherTool = cached(expensiveWeatherTool);
Standard Redis
import Redis from "redis";
import { createCached } from '@ai-sdk-tools/cache';

const cached = createCached({
  cache: Redis.createClient({ url: "redis://localhost:6379" }),
  keyPrefix: "my-app:",
  ttl: 30 * 60 * 1000,
});
IORedis
import IORedis from "ioredis";
import { createCached } from '@ai-sdk-tools/cache';

const cached = createCached({
  cache: new IORedis("redis://localhost:6379"),
  keyPrefix: "my-app:",
  ttl: 30 * 60 * 1000,
});

Universal Redis Support

Works with any Redis client that implements:

  • get(key: string): Promise<string | null>
  • set(key: string, value: string): Promise<void>
  • del(key: string): Promise<void>
  • setex?(key: string, seconds: number, value: string): Promise<void> (optional)

Supported clients:

  • ✅ Upstash Redis - @upstash/redis
  • ✅ Standard Redis - redis
  • ✅ IORedis - ioredis
  • ✅ Redis Clusters - Any cluster client
  • ✅ Custom Redis clients - As long as they implement the interface

Configuration Options

const cached = createCached({
  cache?: any;                    // Redis client (optional, defaults to LRU)
  keyPrefix?: string;             // Cache key prefix (default: "ai-tools-cache:")
  ttl?: number;                   // Time to live in ms (default: 10min LRU, 30min Redis)
  debug?: boolean;                // Debug logging (default: false)
  onHit?: (key: string) => void;  // Cache hit callback
  onMiss?: (key: string) => void; // Cache miss callback
});

Multi-Tenant Apps (Context-Aware Caching)

For apps with user/team context, just add getContext to the cache config:

import { cached } from '@ai-sdk-tools/cache';
// Your app's context system (could be React context, global state, etc.)

const burnRateAnalysisTool = tool({
  description: 'Analyze burn rate',
  parameters: z.object({
    from: z.string(),
    to: z.string(),
  }),
  execute: async ({ from, to }) => {
    // Your app's way of getting current user/team context
    const currentUser = getCurrentUser(); // or useUser(), getSession(), etc.
    
    return await db.getBurnRate({
      teamId: currentUser.teamId, // ← Context used here
      from,
      to,
    });
  },
});

// Cache with context - that's it!
export const cachedBurnRateTool = cached(burnRateAnalysisTool, {
  cacheKey: () => {
    const currentUser = getCurrentUser();
    return `team:${currentUser.teamId}:user:${currentUser.id}`;
  },
  ttl: 30 * 60 * 1000, // 30 minutes
});

Result: Cache keys automatically include teamId and userId - no collisions between users/teams!

Reusable Cache Configuration

For consistent setup across your app, create a configured cache function:

// src/lib/cache.ts
import { cached as baseCached, createCacheBackend } from '@ai-sdk-tools/cache';
import { getContext } from '@/ai/context';

// Create cache backend
const cacheBackend = createCacheBackend({
  type: 'redis',
  redis: {
    client: Redis.createClient({ url: process.env.REDIS_URL }),
    keyPrefix: 'my-app:',
  },
});

// Export configured cache function
export function cached<T extends Tool>(tool: T, options = {}) {
  return baseCached(tool, {
    store: cacheBackend,
    cacheKey: () => {
      const currentUser = getCurrentUser();
      return `team:${currentUser.teamId}:user:${currentUser.id}`;
    },
    ttl: 30 * 60 * 1000, // 30 minutes
    debug: process.env.NODE_ENV === 'development',
    ...options,
  });
}

// Throughout your app
import { cached } from '@/lib/cache';
export const myTool = cached(originalTool);

Streaming Tools with Artifacts…

Description from the npm listing.

  • ai
  • ai-sdk
  • tools
  • cache
  • caching
  • performance
  • llm
  • openai
  • anthropic

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

@ai-sdk-tools/cache weekly downloads on npm, last 90 days: 4,244 weekly downloads as of Dec 5, 2026, +11.8% over 90 days.@ai-sdk-tools/cacheWeekly downloads on npm · Last 90 days4,244downloads / week+11.8% over 90 days01K2K3K4K5K6K7KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@ai-sdk-tools/cache weekly downloads on npm, last 90 days: 4,244 weekly downloads as of Dec 5, 2026, +11.8% over 90 days.

7/30/90-day growth

@ai-sdk-tools/cache weekly downloads growth on npm: -7.4% over 7 days, -4.6% over 30 days, +11.8% over 90 days.@ai-sdk-tools/cacheWeekly downloads growth on npm4,244downloads / week now7-day growth-339 weekly downloads-7.4%30-day growth-205 weekly downloads-4.6%90-day growth+447 weekly downloads+11.8%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@ai-sdk-tools/cache weekly downloads growth on npm: -7.4% over 7 days, -4.6% over 30 days, +11.8% over 90 days.

Ranking history

@ai-sdk-tools/cache npm ranking history: currently #1597 (by weekly downloads).@ai-sdk-tools/cachenpm ranking · by weekly downloads · Last 90 days#1597current rank#1200#1250#1300#1350#1400#1450#1500#1550#1600Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
@ai-sdk-tools/cache npm ranking history: currently #1597 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 80, #17 (overall #1,597)
All npm: every listing in weekly downloads order

Listing placement

AI SDKs378 listings · 19 pages · page 7, #7 (overall #127)
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 (170)
Recent weekly downloads observations for @ai-sdk-tools/cache
Date (UTC)Weekly downloadsChange vs. previous
4,244+295
3,949+186
3,763-347
4,110-294
4,404-446
4,850+206
4,644+61
4,583-103
4,686-694
5,380+148
5,232-1K
6,236-173
6,409+285
6,124—

Similar npm AI SDKs plugins

All 20 @ai-sdk-tools/cache 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/@ai-sdk-tools/cache. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.