Get Started
Examples
Concepts
Resources
Projects
Integrations
API Reference
Caching
copy markdown
Most document workloads are not one request per file. You extract fields, re-run with a different schema, then ask a follow up question, all against the same file.
Interfaze caches the expensive part of the first pass, such as decoding the file and running the specialized model. Repeated requests on the same file or a very similar prompt reuse that work instead of redoing it.
Caching is on by default, cached outputs are not charged again, and there is no separate cache bill.
Detecting a cache hit
Every chat completion response carries a vcache boolean that tells you whether it was served from the verified cache.
Interfaze SDK
const response = await interfaze.chat.completions.create({
messages: [{ role: "user", content: `Summarize this paper\n${paperUrl}` }],
});
// false on the first request, true on the ones after it
console.log({ cached: response.vcache, tokens: response.usage?.total_tokens });Bypassing the cache
Some workloads need a fresh run every time, such as scraping a page that changes by the minute or re-running a search for the newest results.
Skip the cache for a request with the x-interfaze-bypass-cache header:
x-interfaze-bypass-cache: trueIf you use the Interfaze SDK, set bypassCache: true when creating the client instead and the header is added for you. With any other SDK, set the header as a default header on the client so every request carries it.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { Interfaze } from "interfaze";
const interfaze = new Interfaze({
apiKey: process.env.INTERFAZE_API_KEY,
bypassCache: true, // always run the request fresh
});Bypassed requests are billed as fresh calls, so keep the cache on unless you specifically need real-time results.
Learn more about lowering costs and improving speed.