One signed binary. Every feature compiled in. Free to run. Install Crowkis →
← back to the Roost
guidesJune 19, 2026· 5 min read

A drop-in CachedOpenAI for Node, in one wrapper

The Node SDK ships a typed client and a CachedOpenAI wrapper — keep your OpenAI calls exactly as they are, and a semantic cache slips in underneath.

The lowest-friction integration in TypeScript is the one that doesn't change your call sites. The Node SDK's CachedOpenAI wrapper presents the same surface as the OpenAI client, and quietly checks Crowkis before spending a token.

wrap once, cache everywhere
import { CrowkisClient, CachedOpenAI } from "crowkis";
import OpenAI from "openai";

const cache = new CrowkisClient({ host: "127.0.0.1", port: 6379, tenant: "web" });
const openai = new CachedOpenAI(new OpenAI(), cache);

// identical to the OpenAI SDK — but paraphrases hit the cache
const res = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "What's your refund policy?" }],
});
console.log(res.choices[0].message.content, res.cached); // res.cached: boolean

Every response carries a `cached` flag so you can measure your hit rate from the application side, not just the dashboard. The wrapper handles the embedding, the semantic lookup, and the write-back on a miss — your code keeps thinking it's just calling OpenAI.

or the raw client, with retry/backoff
const hit = await cache.cget("when do refunds arrive?", { withConfidence: true });
if (hit && hit.confidence >= 0.88) return hit.value;

const answer = await callModel(prompt);
await cache.cset("when do refunds arrive?", answer, { ttl: 3600 });
return answer;
In plain words: Keep your OpenAI code exactly as it is. The wrapper checks the cache first, so repeated questions stop hitting the API — and every response tells you whether it was cached.