Offline promptfoo evals with llama.cpp and LocalAI

How to point promptfoo at a llama.cpp HTTP server or LocalAI so evals and red team runs stay on your own hardware, with the limits that cap test volume.

On this page

Running promptfoo offline with llama.cpp and LocalAI

A team that cannot send prompts to a cloud API can still run promptfoo evals and red team scans, because promptfoo runs on your own machine and talks directly to the model you point it at. The llama provider connects promptfoo to the HTTP server bundled with llama.cpp, and LocalAI can serve as an OpenAI-compatible wrapper for GGUF models, so promptfoo's OpenAI-style configuration can target it. The prompts, test cases, model outputs and grading results stay on hardware you control, provided the inference server, promptfoo and any grader all run inside your network boundary. Confirm the provider settings against the promptfoo llama.cpp documentation and the promptfoo LocalAI documentation before you build the suite, since the exact configuration keys are documented there.

Three things still need a decision before the run is truly offline. The first is the grader model. Many assertions and red team graders use an LLM to judge outputs, so the judge must also be a local model, or you must accept that outputs leave the site. The second is the network path. Confirm that the machine running promptfoo can reach the llama.cpp or LocalAI host, that no plugin or dependency fetches assets from the internet during a run, and that the npm install and the promptfoo package itself were brought across the boundary through your approved channel. Check the package version you install against the promptfoo npm listing, which also states the Node.js version required.

The third is test volume. Local hardware sets the ceiling on how many probes and cases you can run in a reasonable window, and a red team scan with many plugins and strategies multiplies requests quickly. Measure throughput on your actual GPU or CPU with a small suite, then size the full scan around it. Keep the request concurrency modest so the inference server does not queue or time out, and record the settings alongside results so later runs are comparable. The cost is mostly hardware and staff time you already carry, rather than per-request fees.

What you need before the first offline eval

An offline promptfoo run depends on four things being in place before the first eval starts: a supported Node.js runtime, a local model server with a model loaded, network paths that stay on your segment, and a way to get promptfoo and its dependencies onto the machine without internet access. Confirm each one in your own environment, because the exact llama.cpp and LocalAI versions you run decide which options and endpoints you can use.

Node.js runtime for promptfoo

The promptfoo release current at the time of writing requires Node.js 22.22.0 or newer. Install that runtime on the machine that runs the CLI, not only on the model host, and confirm it with node --version before anything else. Check that your internal mirror or offline bundle carries the same Node.js line, because a mismatched runtime is the most common reason a first run fails before it reaches the model.

promptfoo on npm

llama.cpp server with a GGUF model

The promptfoo llama provider connects to the HTTP server bundled with llama.cpp, so that server must be running and reachable before you write any config. Load a GGUF model you have already reviewed and confirm the server answers a simple completion request from the CLI host. Record the exact llama.cpp build and model file hash, since behavior and endpoints can change between builds.

llama.cpp provider docs

LocalAI with OpenAI-compatible endpoints

LocalAI wraps GGUF models behind an OpenAI-compatible API, which lets promptfoo target it through its OpenAI-style provider settings. Confirm which model names LocalAI exposes and that the chat or completion route you plan to test responds. Pin the LocalAI release in your deployment so the same suite produces comparable results across runs.

LocalAI provider docs

Traffic that stays on the local segment

An offline eval only stays offline if the model server, the promptfoo host and any grader model can reach each other without leaving the segment. Create explicit firewall rules for the model port, and block outbound traffic from the test host to public model APIs so a misconfigured provider cannot send prompts out. Test this by running one eval with the external route blocked and confirming it still completes.

Offline package path for promptfoo

Installing promptfoo on an isolated host means carrying its npm dependency tree across the boundary. Mirror the packages into an internal registry or build a vendored bundle on a connected machine, then verify the integrity of every package you carry in, as NERC CIP-013-2 expects for software crossing an isolated boundary. Record the exact promptfoo version so the release you tested is the one you run.

promptfoo releases

Confirmed versions in your environment

Before the first run, write down the exact llama.cpp build, LocalAI release, model files and promptfoo version you are using, and confirm each against your own environment rather than against this page. These versions decide which provider options and endpoints apply, so treat them as part of the test record. Keep them in the same configuration repository as the eval suite so a later rerun can reproduce the setup.

How prompts stay inside the boundary

The diagram starts at the promptfoo CLI running on a workstation or CI runner inside the network. Each eval request goes to a llama.cpp HTTP server or a LocalAI wrapper on the same network, and the grader model runs there too. Results are written to a local store. The check to make is that no route leaves the boundary, so confirm egress rules block cloud model APIs and that the config points only at internal hosts.

Eval traffic and grading stay on the local network, with no cloud model endpoint in the path.

Configuring the llama provider and LocalAI in sequence

This sequence connects promptfoo to a local llama.cpp server first, then adds LocalAI as a second OpenAI-compatible target. Each step ends with a check so you know the path works before you build larger eval suites.

  1. Install promptfoo from an approved package source

    Your platform team installs promptfoo on the test workstation or runner from a package source your organization has approved, such as an internal npm mirror or a vetted artifact repository. The package requires Node.js 22.22.0 or newer, so confirm that version is present first. Record the installed version and the package checksum in your change record so the same build can be reproduced later. Done means the promptfoo command reports its version and runs without fetching anything beyond the mirror. Confirm the version floor and mirror setup with your own platform team, since they own the registry configuration.

  2. Start the llama.cpp HTTP server with a GGUF model

    Load a GGUF model file that your team has already reviewed and stored on local disk, then start the HTTP server bundled with llama.cpp and bind it to a loopback or internal address. Confirm the exact startup flags and port defaults against the llama.cpp documentation for the build you installed. Keep the model file in a location with restricted write access, because the model is an artifact under test. Done means the server reports that it is listening and that the model has loaded without errors.

  3. Point the llama provider at the local server

    In your promptfoo configuration, set the provider to the llama provider and point it at the address of the llama.cpp server. Keep the configuration file in version control so the provider settings are reviewed like any other code. Use a small, fixed prompt set for this first run so failures are easy to trace to the configuration rather than the prompts. Done means the configuration validates and promptfoo lists the llama provider as a target.

  4. Confirm a single prompt round trip

    Send one prompt through promptfoo to the llama.cpp server and read the raw response in the output. This check confirms network reachability, model loading and response parsing in one step. If the call fails, check that the server is bound to the address in your configuration and that no proxy settings are intercepting local traffic. Done means you receive a complete text response from the local model and promptfoo records it without errors.

  5. Run a smoke-test eval with one assertion

    Create a minimal eval with a single test case and one deterministic assertion, such as a check that the response contains an expected string. Avoid model-based graders for this step, because a grader would add a second model to the run. Execute the eval and review the pass or fail result and the stored output. Done means the eval completes, the assertion evaluates as expected and the result is written to your local output.

  6. Add LocalAI as an OpenAI-compatible target

    Start LocalAI with the GGUF model you want to compare and confirm its OpenAI-compatible API is reachable on an internal address. In a second provider entry, select the OpenAI-compatible provider type and override the base URL so requests go to LocalAI instead of a hosted service. Set the API key to a placeholder value that LocalAI accepts, and keep real credentials out of the file. Confirm the model name and endpoint details with the LocalAI documentation for your release. Done means promptfoo lists both targets and the LocalAI entry validates.

  7. Verify no outbound connections during the run

    Repeat the smoke-test eval against both targets while a network monitor or host firewall logs outbound connections from the test machine. Allow traffic only to the loopback or internal addresses of llama.cpp and LocalAI, and block everything else during the run. Review the logs afterward and confirm that no connections left the approved boundary. Done means the eval completes against both targets and the connection log shows no external destinations. Ask your security team to define the monitoring method and retention for this evidence.

Choosing llama.cpp or LocalAI for your environment

A single engineer testing on a workstation usually needs the shortest path to a working local endpoint and the least operational overhead. The llama provider talks to the HTTP server bundled with llama.cpp, so the engineer starts one server against one GGUF file and points promptfoo at it. There is no gateway layer to configure, and model swaps are a restart with a different file. LocalAI adds a wrapper that exposes an OpenAI-compatible API, which helps when the same suite must also run against hosted OpenAI-style endpoints.

  • Model management: llama.cpp serves the model file you load at startup, so the engineer tracks the GGUF file and its checksum by hand.
  • API compatibility: LocalAI keeps OpenAI-style request shapes, which reduces provider configuration changes between local and hosted runs.
  • Server operation: llama.cpp needs one process to start and stop, while LocalAI adds its own configuration and image to maintain.
  • Resource limits: Test volume is bounded by the workstation's memory, cores and, if present, GPU, so large red team scans may run slowly.
  • Data location: Prompts and outputs stay on the machine, which suits early experiments on non-production content.

Before committing, confirm the exact server version and model file your team will use, and run one small eval to check the provider works end to end.

Mapping promptfoo settings to local server fields

This table maps each promptfoo provider setting to the local llama.cpp or LocalAI field it must match, and to the value you should confirm on the running server. Use it as a checklist before the first eval, since a mismatched address or model name is the most common reason an offline run fails. The main takeaway is that the server, not promptfoo, decides the model name and port, so read them from the server first.

Promptfoo settingPoints atConfirm on the running server
Provider ID llama (llama.cpp)The HTTP server bundled with llama.cppServer started and listening; the provider docs list the exact provider ID format to use
llama.cpp server addressHost and port the llama.cpp HTTP server binds toAddress and port from the server start command, reachable from the machine running promptfoo
llama.cpp model nameModel label promptfoo sends with each requestName the server reports for the loaded GGUF file, since the server may ignore or echo it
LocalAI base URLThe OpenAI-compatible API root LocalAI exposesBase URL ending where LocalAI serves its /v1 routes, with the port matching the container or process
LocalAI model identifierThe model name configured in LocalAI for the GGUF fileIdentifier listed by LocalAI's model endpoint, matched exactly including case and file naming
API key field (LocalAI)Credential sent with requests, if LocalAI enforces oneWhether your LocalAI instance requires a key; a placeholder value may be enough if it does not
Grader model referenceThe local model promptfoo uses to score outputsGrader points at the same offline server and a model that is loaded, so grading never leaves your network
Red team attacker and grader providersModels that generate and judge attack promptsBoth fields reference local endpoints if the run must stay offline; check each one separately

What limits test volume on local hardware

A local llama.cpp or LocalAI server sets the ceiling on how many probes a promptfoo run can finish overnight. The factors below interact, so change one at a time and measure. Start with a pilot run sized to your own machine.

Model size and quantization

Larger models and higher-precision weights take more memory and produce tokens more slowly, so each probe takes longer. A smaller quantized GGUF model usually finishes more probes per hour but may behave differently under attack, which weakens the result. Test the model you plan to ship or the one your users will reach, and record the exact file name and quantization level in your run notes.

llama.cpp provider docs

Memory and accelerator capacity

The model weights, the context cache and the server's working memory must fit in RAM or GPU memory together. When they do not fit, the server swaps, offloads layers to the CPU or fails to load, and throughput drops sharply. Check memory use during a full pilot run, not only at idle, and confirm which layers run on the accelerator.

Concurrency settings

Parallel requests share the same model and memory. Raising the number of parallel promptfoo workers or server slots can raise total throughput up to a point, then increases latency and timeouts as requests queue. Set the promptfoo concurrency and the server's parallel slot count together, then watch for timeouts and dropped responses before raising either value.

Prompt and response length

Long system prompts, multi-turn sessions and verbose model answers all consume context and generation time. Red team strategies that wrap attacks in long templates can make each probe several times heavier than a short direct prompt. Measure the token count of a typical probe and of the longest probe in your plugin set, and cap response length so one verbose answer does not stall a batch.

Grading cost on the same machine

If the same local server acts as the grader for llm-rubric or similar assertions, every probe needs a second generation. This can roughly double the work for each test case on a single box. Decide whether a separate grader host or a deterministic assertion is practical before you size the run, and confirm the grader model's output is stable enough to rely on.

Pilot runs and measured throughput

Run a small pilot with a fixed plugin set, a fixed number of probes and the same settings you plan to use at scale. Record probes completed per hour, timeout rate and peak memory, then extrapolate only from those numbers. Do not rely on a vendor's throughput figure, because it was measured on different hardware, quantization and prompt sizes.

Why offline runs fail and how to fix them

This table lists the failures teams most often hit when promptfoo runs against llama.cpp or LocalAI on a closed network, with the likely cause and first fix for each. Read it top to bottom when a run fails, starting with connectivity before you change model or grader settings.

FailureLikely causeFirst fix
Server unreachable from the runnerThe llama.cpp or LocalAI server listens on localhost, or a firewall blocks the port from the machine running promptfooConfirm the server bind address and port, then request its HTTP endpoint with curl from the runner host before running any eval
Wrong model name or base URLThe provider config names a model that the server did not load, or the base URL omits the path prefix the server expectsCheck the model name the server reports for its loaded model, and match the base URL in the provider config to that exact address
Timeouts on large GGUF modelsLoading or generating with a large quantized model takes longer than the default request timeout, especially on CPURaise the request timeout in the provider config, then test one prompt by hand to measure generation time
Grader output cannot be parsedA small local grader model returns prose or extra text instead of the JSON or label format the assertion expectsPin the grader prompt to a strict output format, test the grader on a few known answers, and use a stronger local model as judge
Runs stall under concurrencyParallel requests exceed the server's slot or context capacity, so requests queue or failReduce promptfoo concurrency to the number of parallel slots the server was started with, then increase it while watching memory
Results change between runsSampling settings are not fixed, or the server restarted with a different model file or context sizeSet temperature and seed in the provider config, and record the model file and server flags alongside each run

Questions teams ask before running promptfoo offline

Does running promptfoo offline cost anything in licensing?

No license fee applies to the software itself. promptfoo is licensed under the MIT license, and the Community edition is free and includes all LLM evaluation features and all model providers, including the llama provider and LocalAI. The costs you do carry are the hardware that runs the inference server, the staff time to build and maintain the eval suite, and any implementation work you hand to a partner. Those costs are separate from the license and depend on your environment, so ask for each one to be itemized in a written quote.

How long does a first offline eval run take to set up?

No duration for this setup was supplied, so treat any figure you hear with caution. The time depends on whether the model files are already on the machine, whether the llama.cpp HTTP server or LocalAI is already running, and whether the team has Node.js 22.22.0 or newer installed for the current promptfoo npm release. A first run that checks one provider with a handful of test cases is usually a small step once those prerequisites are in place. The longer work is writing assertions that reflect your use case, which is the part to plan for.

What must our team supply before an offline promptfoo setup can start?

Four things need to be in place before work begins:

  • Hardware with enough memory and compute for the model size you intend to test, sized against the inference server you choose.
  • Model files in a format the server accepts, such as GGUF for llama.cpp or LocalAI.
  • Network access rules that allow the machines to reach each other while blocking outbound traffic, plus a secure route for moving packages and model files across the boundary.
  • A named owner for the eval suite who maintains test cases, reviews failures and decides when a model change is acceptable.
Can our own engineers set up promptfoo with llama.cpp or LocalAI without a partner?

Yes, a capable engineering team can do this in-house, since the llama provider targets the HTTP server bundled with llama.cpp and LocalAI exposes an OpenAI-compatible API. The work that most often stalls internal teams is not the first connection but the surrounding decisions: verifying every package and model file brought across an isolated boundary, deciding how the grader model is chosen, and keeping test volume within what the hardware can run. If your team already runs air-gapped infrastructure and has someone who owns evaluation, the build is largely within reach. Confirm the provider configuration against the current promptfoo documentation before you rely on it.

When does a partner help most with offline promptfoo evals?

A partner adds the most value when the offline setup has to pass a review by security, compliance or an assessor. DeployOpen plans, implements and documents self-hosted platforms inside your own infrastructure, including air-gapped networks, and can prepare the evidence those reviews ask for. DeployOpen does not issue audit reports or certifications. Independent auditors and certification bodies do that work. A partner is also useful when you need the eval suite and the red teaming runs wired into a regulated delivery process, or when the team lacks the time to maintain the suite alongside production work.

What limits how many tests we can run against a local model?

The main limit is the hardware serving the model. Each test case sends a request that occupies the inference server, so throughput is bounded by the memory, compute and concurrency the server can handle. Larger models answer more slowly on the same machine, which lengthens each run. Red teaming multiplies the volume, so a scan that is comfortable on a cloud API can take far longer on a single local server. Ask your team to benchmark one representative run on the target hardware and size the suite from those results rather than from assumptions. promptfoo's Community edition includes red teaming with 10k probes per month, which is a license allowance, not a hardware measure.

Does running offline mean our test data never leaves the network?

promptfoo's documentation states that the software runs completely locally, with evals running on your machine and talking directly with the LLM. When the model and grader are both local servers, test prompts and outputs stay inside your environment. Confirm this in your own setup, because any step that reaches an external service, such as an update check, a package download or a remote grader, would change the picture. Verify your network rules and the configuration of every provider in the suite before treating the setup as fully offline.

What a DeployOpen engagement covers for offline testing

A DeployOpen engagement for offline promptfoo testing starts with planning the boundary: which machines run the llama.cpp HTTP server or LocalAI, which models and grader models are allowed inside that boundary, where evaluation results are stored, and which network paths are blocked. Scope options follow from those decisions. A narrower engagement covers only the boundary plan and the provider configuration. A broader one adds installing and configuring the llama provider or a LocalAI target, building a first eval suite and a red team suite against the models you have approved, and checking that no traffic leaves the environment during a run. Each option is agreed in writing with its deliverables and timeline before work starts, and the price follows from that written scope rather than from a standard package.

The deliverables we would expect to discuss include the working provider configuration, the eval and red team configuration files, a runbook for running and re-running suites on the isolated host, and a handover session with the engineers who will operate it. The runbook should cover how models and promptfoo itself are brought across the boundary, how versions are pinned, and how results are retrieved. Ask whether the self-hosted promptfoo server is in scope. Its documentation describes a single SQLite database that cannot be shared across replicas and lacks built-in authentication, so a team sharing results may need the Enterprise On-Premise edition instead, which is quoted separately.

When you request a quote, ask the provider to separate one-time work (boundary design, configuration, first suites, runbook) from recurring work (model updates, promptfoo upgrades, new suites as the application changes). Ask what hardware or virtual machine capacity they assume, who supplies it, and who holds the approval steps for moving software into the environment. Confirm these points in your own environment before scoping, because they change both effort and risk. Any timeline in a proposal should be tied to those dependencies rather than presented as fixed.

How DeployOpen scopes and supports offline promptfoo work

DeployOpen plans and runs offline promptfoo evaluation setups inside infrastructure you control, pointing promptfoo at llama.cpp servers or LocalAI on hardware your team operates. Engagements are fixed-scope, with the setup, test volume limits and handover agreed in writing before work starts.

How we scope

  • Inventory which models, inference hosts and grader models must run without internet access, and where each one lives.
  • Confirm the llama.cpp server version, LocalAI build and GGUF model files your team will test against.
  • Agree in writing how many probes and eval cases the available hardware can run within your time window.

How we build

  • Configure the promptfoo llama provider against your llama.cpp HTTP server and check each request path works offline.
  • Set up LocalAI as an OpenAI-compatible target for GGUF models and verify the endpoint and model names.
  • Package promptfoo, its dependencies and the Node.js runtime for transfer, and verify every artifact before it crosses the boundary.

How we hand over

  • Document the provider configuration, model file inventory, hardware limits and the steps for running evals and red team scans offline.
  • Walk your engineers through running a suite, reading results and recording which model build produced each result.
  • Deliver a record of the offline transfer, including checksums and the versions of each component installed.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped to your offline environment.
  • Plan how new model files and promptfoo releases are reviewed and carried across the isolated boundary.
  • Confirm with your team the owner for model updates, hardware capacity reviews and repeat test runs.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.