
Security News
Lovable’s OJ Rewrites Vite’s Dev Server in Rust as AI Lowers the Cost of Forking Open Source
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.
ai-prompt-cache-krxgu
Advanced tools
A tiny middleware for the Vercel AI SDK that sets deterministic prompt cache hints across providers. It automatically:
A tiny middleware for the Vercel AI SDK that sets deterministic prompt cache hints across providers. It automatically:
promptCacheKey for OpenAI models.cacheControl metadata they expect.import { wrapLanguageModel } from 'ai';
import { openai } from '@ai-sdk/openai';
import { withPromptCache } from '@krishgupta/ai-prompt-cache';
const model = wrapLanguageModel({
model: openai('gpt-4o-mini'),
middleware: withPromptCache({
select: 'system-head',
openai: { enable: true },
anthropic: { enable: false },
extraKeySalt: 'my-app',
}),
});
promptCacheKey greatly improves hit rate.cacheControl markers and you exceed the model's minimum token requirements (e.g. 1024 tokens for Claude 3.5 Sonnet). This middleware sets the markers on the head system messages.| Option | Default | Description |
|---|---|---|
select | 'system-head' | Which prefix of messages to hash. Supply a custom function to control the split. |
openai.enable | true | Toggle the OpenAI integration. |
anthropic.enable | true | Toggle the Anthropic integration. |
anthropic.ttl | undefined | Optional TTL for Anthropic's ephemeral cache. |
extraKeySalt | undefined | Extra data mixed into the hash (use RAG chunk IDs here). |
Use Vercel AI Gateway dashboards to track TTFT improvements, cache reads, and write volume. OpenAI responses also expose providerMetadata.openai.cachedPromptTokens when the cache is being hit.
FAQs
A tiny middleware for the Vercel AI SDK that sets deterministic prompt cache hints across providers. It automatically:
We found that ai-prompt-cache-krxgu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.