What the promptfoo response cache saves and when your team needs it
The promptfoo response cache reuses model responses from earlier calls, so a repeated request can be answered from stored output instead of a new call to a paid model API. That shortens reruns and reduces spend on the calls it can serve. The cache matters most when the same prompts and providers run many times, such as nightly eval suites, regression checks after a small prompt edit, and red team scans that replay large probe sets. A one-off exploratory run gains little from it, because there is nothing earlier to reuse. Before you budget around the savings, measure how many calls your own runs repeat, since any change to a prompt, model or setting creates requests the cache has not seen.
The promptfoo documentation states that the software runs completely locally, with evals running on your machine and talking directly to the LLM. Cached responses stay with the run environment, on the machine or CI runner that made the calls. Confirm the cache location, how long entries are retained and how to clear them in the documentation for the version you run, because those details decide whether a laptop, a CI runner and a container each start cold. Also confirm the Node.js requirement: the current npm release, 0.124.1, requires Node.js 22.22.0 or newer. Finally, run a deliberate prompt or provider change and check that it triggers fresh calls before you trust cost or pass-rate figures from a cached run.
How a test case moves through the cache during an eval
This flowchart follows one test case from the moment it enters an eval run. If caching is disabled, the request goes straight to the provider and the result is not saved. If caching is enabled, the cache is checked with a key built from the request. A stored response is returned on a hit, while a miss calls the provider and saves the result. Both paths then reach the assertions and the report. The edge labeled invalidate marks where a provider or prompt change should clear entries, so confirm that step in your own workflow. This is a general request flow and does not show the exact key format.
General request flow for a cached eval, from test case to report.
Cache options and when each one fits
This table compares five cache choices for promptfoo runs: keeping the cache on, disabling it for one run, clearing it after a model or prompt change, moving it for CI runners, and confirming setting names for the version you pin. Read each row for its effect on speed, API spend and the risk of stale results, then check which role owns the decision. The main takeaway is that the cache saves time and money only while the stored responses still match what you are testing.
| Option | Speed and spend | Stale-result risk | Reader's job and when it fits |
|---|---|---|---|
| Cache on for local iteration | Repeated runs reuse stored responses, saving time and API spend on unchanged cases. | Low while prompts, models and test data stay the same. A provider-side change behind the same model name may not invalidate stored answers. | Developer. Fits daily prompt tuning on a workstation where quick feedback matters most. |
| Disable the cache for one run | Every case calls the provider, so the run is slower and costs more. | Cache-driven stale results are ruled out for that run. | Developer or CI owner. Fits a final check before reporting results or when a cached answer looks wrong. |
| Clear the cache after a model or prompt change | The first run afterward is slower and spends API credits again. | Old answers from the previous setup stop being reused. Skipping the clear after a change is how they reach new comparisons. | Developer or platform lead. Fits any change to model, prompt or provider settings before comparing results. |
| Move the cache directory for CI runners | Runners that keep the directory between jobs reuse answers. Ephemeral runners start empty and pay full cost on each job. | A shared directory can carry answers across branches, so scope it to the pipeline that owns the results. | CI owner. Fits runners where the cache location must be set, persisted or discarded on purpose. |
| Confirm setting names for the pinned version | Speed and spend change with the setting, so check the effect in a test run first. | A misnamed setting may not take effect, so stale or uncached results can go unnoticed. | Platform lead. Confirm the config key, CLI flag and environment variable names in the promptfoo docs for the pinned version. |
Where the promptfoo response cache should live: laptop, CI runner or shared server
On a developer laptop, the cache serves repeated provider calls while you iterate on prompts, assertions and test cases. The software runs on your machine and talks directly to the model, so cached entries share the lifetime of the files on that disk. Their main value is saving time and API spend during the edit and run loop.
- Hits depend on unchanged requests: Entries help when you rerun identical test cases. Every prompt edit or variable change produces a new request, so expect misses after changes.
- Confirm the cache key inputs: Check which fields (prompt text, provider settings, model name, variables) feed the key in your installed version. A changed setting should miss, and you should verify that with a test run.
- Confirm the cache location: Find the directory or store where entries are written, and whether removing it is the documented way to clear the cache.
- Nothing is shared: Entries cached on one laptop do not reach a colleague or a pipeline, so the same suite pays the provider cost again on each machine.
- Confirm expiry: Check whether entries expire on their own and how long they are kept. Do not assume a lifetime from this page.
Before relying on laptop hits for a decision, confirm the cache location, the key inputs and the expiry behavior in the version you have installed.
A CI runner either starts clean for each job or reuses a workspace that keeps files between jobs. On a clean runner, the cache starts empty, so each job pays the full provider cost unless the pipeline restores earlier cache data. A reused workspace may keep entries between jobs, but only if the runner keeps the directory and no later step deletes it.
- Clean runners start cold: Every job on an ephemeral runner pays for its first run of each case unless the pipeline restores a saved cache.
- Restoring needs a stable path: Confirm the directory promptfoo writes to, then include that exact path in your CI cache or artifact step so jobs read the same location.
- Stale hits after changes: Restored entries from another branch can answer for a changed prompt or provider if the key does not cover that change. Confirm this with a deliberate prompt edit before you trust the results.
- Parallel jobs collide: Jobs that write one cache directory at the same time can interfere with each other. Confirm the behavior and keep parallel jobs on separate paths if needed.
- Retention and size: Saved caches grow with the suite, and your CI platform sets retention and storage limits. Check both against how often prompts and models change.
Before enabling cache restore, confirm the cache directory, the rules for restoring it and whether your CI platform's retention fits how often your prompts change.
The self-hosted promptfoo app is an Express server that serves the web UI and API, and it stores its data in a local SQLite database. The documentation states that this database cannot be shared across replicas, and that the self-hosted app has no horizontal scaling and is not recommended for production use. Treat the server as a place to view and store results until you have confirmed where response cache entries live.
- One database per instance: Because the SQLite database cannot be shared across replicas, two replicas behind a load balancer do not give you a common store.
- Confirm the storage location: Check whether response cache entries are written to that SQLite database or to the local run directory on each CLI machine. Do not assume sharing until you know which one applies.
- Runners keep local copies: If entries sit in the run directory, each laptop and CI runner keeps its own copy even when results upload to the server.
- Confirm persistence: Check that the Docker volume or Helm persistent volume keeps the database across restarts and upgrades. The self-hosting documentation covers the deployment options.
- Limited access controls: The self-hosted app has no RBAC, built-in authentication or SSO, so restrict network access to the server and the data it holds.
Before assuming entries are shared, run the same suite from two machines and check whether the second run gets cache hits.
Setting up the promptfoo response cache step by step
This sequence takes a team from an unpinned promptfoo install to a cache it can trust. It pins the promptfoo and Node.js versions, records where cached responses live, sets the cache behavior, and proves with a baseline run and a changed prompt that hits and misses behave as expected. The team finishes with written clear and disable commands for everyone who runs evals.
Pin promptfoo and Node.js versions
The engineering lead who owns the eval repository sets one promptfoo version and one Node.js version for every developer machine and the CI runner. The promptfoo package on npm lists release 0.124.1, published on 8 October 2026, as requiring Node.js 22.22.0 or newer, so pin Node.js at that level or higher. Record the exact promptfoo version in the lockfile or container image, and confirm the pinning syntax in the promptfoo documentation for the version you choose. Done when promptfoo reports the same version on a laptop and on the CI runner.
Locate and record the cache directory
Run one small eval on a developer machine, then find the directory where promptfoo writes cached provider responses. Check the promptfoo documentation for the default location on each operating system and for the setting that moves it. Record the path in the team runbook with the owner of each machine or runner that holds a cache, because a cache on one runner does not help another. Done when you can list that directory after the run and see files with timestamps matching the run you just did.
Set cache behavior in config or environment
The team lead decides where the setting lives: the eval config for settings that should travel with the suite, or environment variables for values that differ between laptops and CI. Turn caching on for the default run, and confirm the exact key or variable name in the promptfoo documentation for the pinned version before you commit it. Keep the setting in version control so reviewers see every change to it. Done when a run on the same config shows the cache behaving as you set it, confirmed by the cache directory changing after the run.
Run the baseline eval twice
Run the same eval twice in a row with no edits between runs. The first run calls the provider and fills the cache. The second run should return stored responses, which you can confirm by a clearly shorter run time and by the provider's request count on your provider dashboard staying flat between the two runs. Keep both result files so the team can compare them. Done when the second run shows the same pass and fail results as the first and the provider's request count did not rise.
Change one prompt and confirm misses
Edit a single prompt, changing one word or one line, and run the eval again. Test cases that use the edited prompt should miss the cache and call the provider, while test cases using unchanged prompts should still return stored responses. Compare this run with the baseline to see which rows were fetched again. Repeat the check with a provider setting change, such as the model name, and confirm in the documentation which fields form the cache key. Done when the changed rows show fresh provider calls and the unchanged rows remain cached.
Document the clear and disable commands
Write the cache-clear command, the command or setting that disables caching for a single run, and the setting that disables it for a whole project into the team runbook. Confirm the exact syntax in the promptfoo documentation for your pinned version, then run each command once on a test machine and check that the cache directory changes as described. Name who clears caches after a provider or prompt upgrade, and include the directory path from the earlier step. Done when a teammate who did not do this setup can clear the cache and run a disabled eval using the runbook alone.
How stale results appear after a provider or prompt change
Cached results go stale in four predictable ways: the model behind a provider changes, a prompt edit leaves the cache key unchanged, a judge's grades outlive the judge, or a CI job restores another branch's cache. Each one looks like a normal run, so check cache hits and keys before you trust a pass rate.
Cached output outlives the model
A provider can change the model behind a stable model name, or ship a new version under the same identifier, while the cache keeps returning output from the old one. Cached output outlives the model that produced it, so the run looks unchanged after a provider announcement, and differences appear only on cases that miss the cache. Run the same cases with caching off and compare outputs and grades. Confirm which model version your provider identifier resolves to, then clear the cache for that provider and re-baseline expected results.
Prompt edit with no effect
Teams expect a prompt edit to produce fresh responses, but a cache entry is invalidated only by the inputs it keys on. A prompt edit can leave the cache outcome unchanged, so a rerun reports the same scores with hits on the cases you changed. Check the run output for hits on cases you expected to miss, and confirm which inputs your key uses, such as rendered prompt text, variables and provider settings. Disable the cache for the run that tests the edit, then re-baseline once the new prompt is confirmed.
Judge grades no longer current
LLM-graded assertions depend on the judge model, and grades can persist in the cache after that judge changes. Old grades can outlive the judge that issued them, so the pass rate stays stable even though the judge now scores borderline responses differently. Check by changing only the judge in a test config and regrading the same responses with cached grades cleared. Fix it by clearing grading entries and re-baselining: regrade a fixed response set with the current judge and record those grades as the reference.
CI cache from an old branch
CI pipelines often restore a cache saved by an earlier job, and that job may have run on another branch with different prompts or provider settings. A restored cache can belong to another branch, so a pull request passes or fails on results that match an older branch, with hits on prompts it changed. Check the restore key in the pipeline log and confirm it includes hashes of your prompt files and configuration. Fix it by adding those files to the cache key, clearing the CI cache, or disabling caching for the gate job.
When to keep the cache off for an eval run
Turn the cache off for a run when a replayed answer would hide the thing that run exists to measure. A deliberate re-test of provider stability is the clearest case: if the cache returns stored responses, the run shows that the cache repeats itself, not that the provider still behaves the same way. Latency and cost measurement fail similarly, because cached responses do not carry the time or tokens a live call spends, so any timing or spend assertion you have set will look better than the provider really performs. A red team run needs fresh responses to surface new failures, since a cache can only replay outputs the team has already seen. A release gate that must reflect current provider behavior cannot rely on answers stored on an earlier day. Before you disable anything, check that the run's purpose falls into one of these four cases.
Scope the disable to the run that needs it and leave the team default alone. Pass the setting on that one command, for example the --no-cache flag on a local eval or in the single CI job that performs the re-test, so the shared config and later runs stay as they were. Avoid exporting a variable in a shell profile or CI-wide settings, because every later run would inherit it. Confirm the exact flag and any matching environment variable against the caching documentation for the promptfoo version you run, since a silently ignored setting is the first thing to check when fresh responses do not appear. Also confirm whether a run with the cache off still writes its new responses to the cache. If it does, a later default run may reuse them, which should be known before the next release gate. Do not clear the cache to get the same effect, because that discards entries other runs still rely on.
Record in the report that the cache was off, so a reviewer can tell a fresh run from a replayed one. Put the fact in the run metadata that travels with the results: the flag used, the job or person who ran it, a one-sentence reason, and the promptfoo version and provider model identifier. Check which fields your chosen output format keeps, because a JSON, HTML or JUnit file may not carry the flag unless the team adds it to the run name or the CI job summary. For a release gate, store the cache-off result as the evidence for that release and keep it separate from cache-on runs in the same history, so a later comparison does not mix the two. When a reviewer asks why one gate passed on a fresh run and an earlier one on a cached run, that record answers the question without a rerun.
Security and data handling for cached responses
Caching stores eval inputs and outputs on disk, so it inherits the sensitivity of the data you test with. The cards below cover what gets written, where it sits, and how long it persists. Confirm exactly what the cache stores in the docs for your version, and align its location with your data classification rules.
What a cache entry holds
A cache entry can hold the prompts, variables and outputs for each request: the prompt text, the test variables filled into it, and the model output returned. Any of these may carry internal business logic, document excerpts or personal details, depending on what your suite sends. Before you enable caching, list those fields and confirm against the docs for your version exactly what is written to disk.
Sensitive data from datasets
Test datasets loaded from CSV files, spreadsheets or Hugging Face datasets can contain live customer records, health information or account data copied in for realism. Once those rows pass through a provider call, their outputs can be cached alongside them, so the sensitive content outlives the run. Ask the data owner whether the dataset may be stored in a cache at all, and use anonymized or synthetic rows where the answer is no.
Cache directory permissions
The cache lives in a local directory on the machine that runs the eval, so its protection is whatever the operating system grants that folder. On a shared workstation or build host, other local accounts may be able to read it unless you restrict file permissions on the directory. Check the owner and mode, keep the folder out of synced locations such as cloud drives, and confirm the default location in the promptfoo introduction and your version's docs.
CI caches and artifacts
In CI, the cache directory may be saved as a pipeline cache, uploaded as a build artifact, or both. Artifacts may be visible to anyone who can view the pipeline run, and a pipeline cache may be restored by jobs on other branches. Check whether your CI configuration archives the cache path, which cache key it uses, and who can download artifacts from merge request or pull request runs.
Copies on laptops and runners
Copying a cache directory to another laptop or runner moves every entry it holds, including sensitive inputs and outputs, to a machine with its own access controls. A runner image built with a cache can also carry those entries into later jobs. Before copying, decide which machines may hold this data, and delete the copy from any host that falls outside that set.
Retention and deletion
Unless you clear it, cached entries may remain on laptops, runners and archived artifacts after an eval project ends. Write a closeout checklist that lists every location the cache touched, deletes each copy, and records when it was done. Confirm in the docs for your version whether the cache can be cleared by command and whether old entries are pruned automatically.
Limits to confirm before relying on the cache in your environment
Start by confirming what the cache keys on, because that decides when a stored response is reused and when it is not. Do not assume it. Run the same eval twice, then change one input at a time: the prompt text, the model name, a provider configuration value and a variable in a test case. After each change, check whether the second run calls the provider again. Repeat this for every provider you use, and for every assertion type that calls a model, such as model-graded checks, because coverage may differ between them. Write down which cases hit the cache so your team can point to observed behavior when it signs off.
Two behaviors are easy to miss. First, test how the cache interacts with the retry feature. A retried call that returns a stored response can hide the provider error you meant to observe, and a retry that bypasses the cache spends tokens again. Run a case that fails on purpose, then check the output and the provider call count for that case. Second, confirm whether cached entries survive a promptfoo version upgrade. Run one known eval on the current version, upgrade in a test environment, and run it again while comparing how many cases still hit the cache. If entries do not carry over, expect the first run after each upgrade to call the provider for every case and budget for that.
Test cache sharing across CI jobs before you build a pipeline on it. The self-hosted promptfoo documentation describes the server's data as stored in a local SQLite database that cannot be shared across replicas. It also lists no horizontal scaling and no built-in authentication, and says the app is not recommended for production use. Confirm for your version whether the response cache lives in that database, on the runner's disk or somewhere else. If every job starts on a fresh runner, a local cache will not persist unless you restore it from a stored cache location or artifact. Run two consecutive jobs on the same runner type and confirm the second one hits the cache before you depend on it.
Questions teams ask about the promptfoo response cache
What does it cost to set up the promptfoo response cache?
Promptfoo is MIT licensed, so the software itself carries no license fee. What you pay for is setup work, CI runner time, cache storage and the provider API spend that still occurs on cache misses. Setup effort rises with the number of providers, since each one has its own keys, model names and settings to handle correctly. CI topology matters too: ephemeral runners need a way to keep the cache between jobs, while persistent runners need less plumbing. The number of suites and how often the team changes prompts or models also drive effort, because every change adds misses and requires a fresh baseline. Setup is largely one-time, while storage, upkeep and periodic uncached re-runs recur. When you request a quote, ask for the written scope to list providers, CI systems, suites and the expected change cadence.
How long does it take to configure the cache for a team?
The duration depends on scope, so ask for the timeline in the written scope before work starts. Work usually covers confirming how the cache behaves in your promptfoo version, wiring it into each pipeline, verifying hit and miss behavior and documenting the operating rules. Your team provides read access to the repository and pipeline configuration, provider API keys kept in your existing secrets system and injected at run time, a test pipeline where changes can be tried safely, and a named owner who approves cache policy changes. Delays usually come from missing access, unclear provider lists or waiting on approvals, so confirm those items first. Ask any partner to list which of these items they expect you to supply.
Can our own team set up the promptfoo cache without an implementation partner?
Yes, a team that already runs promptfoo in CI can usually set up a single-provider cache from the documentation, provided someone owns the pipeline changes and the testing. Partners add the most value when the setup spans several providers, multiple CI systems or a secrets process that auditors will review. DeployOpen implements, integrates and documents self-hosted open-source platforms in your own infrastructure, and its work on promptfoo can include CI integration, secrets handling, a tested pipeline and a runbook for clearing or bypassing the cache. Engagements are typically fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and ongoing upgrades and testing are available as retainers. Decide with your team which parts you keep in-house and which you outsource.
How do we avoid stale promptfoo cache results after a model change?
Treat every model, provider setting or prompt change as a reason to run without the cache until you have a fresh baseline. Confirm in the promptfoo documentation for your version which inputs form the cache key, and whether changes to provider settings such as model name, base URL, temperature or system prompt create new entries. Practical controls include pinning explicit model identifiers so that a provider alias cannot change silently, keeping provider configuration in version control, clearing or bypassing the cache on the first run after any model change, and recording in each report whether cached responses were used. Make uncached runs the rule for baseline comparisons, and have your owner test the process with a deliberate, harmless change to confirm that stale entries are not reused.
Can the promptfoo response cache be shared across CI runners?
It depends on where the cache is stored, so confirm that first in the promptfoo documentation for your version. If the cache sits in a local directory on an ephemeral runner, each job starts cold unless your CI system restores that directory between jobs, and restored caches must be keyed so that a change in configuration produces a new key. Persistent runners can keep the directory, but parallel jobs that write to the same store need testing for conflicts. Do not assume a shared database either: the self-hosted promptfoo app uses a local SQLite database that cannot be shared across replicas and is not recommended for production use. Test sharing with two parallel jobs before relying on it, and check whether each job reuses entries as expected.
Does the promptfoo response cache change red team results?
It can, so decide before a release scan whether cached responses are acceptable as evidence. A cache returns a stored response for a matching input, which means a repeated probe may report an older model's behavior as if it were current. Strategies that generate varied attacks may produce new inputs that skip the cache, so the effect varies by plugin and strategy. Confirm the exact behavior for the plugins you use in the promptfoo red teaming documentation. A sound policy is to run red team scans uncached for release evidence, use the cache only for development iterations, and record the cache state in every report that goes to a reviewer, together with the configuration, model identifiers and run date.
What should an engineer check when cached promptfoo results look wrong?
Start by checking whether the run used cached responses, then compare the inputs that form the cache key across the good and bad runs. Confirm the cache path is the same and writable in each job, that provider configuration and environment variables match, and that prompt files and test data are the versions you expect. Check whether errors or timeouts were stored, because a stored failure can replay in later runs, and confirm that storage behavior for your version in the documentation. Use the verbose or debug logging described in the promptfoo documentation to see per-test cache status. If the problem persists, clear the cache in a scratch copy of the pipeline and re-run to separate a stale entry from a configuration change, then record the finding in your runbook.
How DeployOpen scopes and supports promptfoo cache configuration
DeployOpen plans and implements promptfoo cache configuration inside your own infrastructure, so cache location, clearing rules and CI handling are written down before they affect results. Scope, build and handover follow a written plan agreed before work starts. Engagements are fixed-scope, and ongoing support is available as a retainer.
How we scope
- We confirm which promptfoo versions, providers and CI systems the cache must serve before configuration work starts.
- The written scope names where the cache lives, who clears it, and when runs must bypass it.
- Fixed-scope terms list deliverables and timelines in writing, so the cache rules are reviewable before work begins.
How we build
- We set up the cache location and its on or off behavior for the self-hosted environment you approve.
- We test that a repeated eval returns cached results, and that a changed prompt or provider triggers fresh calls.
- We document each cache clearing step, so operators know when stale results could appear and how to remove them.
How we hand over
- You receive a runbook covering cache location, clearing steps, bypass options and the CI cache setup.
- The handover includes a test run showing fresh results after a prompt change and after a provider change.
- Your engineers receive a walkthrough of each setting, with open items listed for your own confirmation.
How we support
- Ongoing support is available as a retainer, covering promptfoo upgrades and cache behavior after new releases.
- After a promptfoo upgrade, we re-run the cache checks so the risk of stale results is tested again.
- Retainers can also include continuous testing of eval pipelines, if your team wants it in the written scope.

