Testing LiteLLM proxy models with promptfoo, one suite for many providers
If your models sit behind a LiteLLM gateway, you can point one promptfoo suite at the proxy instead of maintaining a separate configuration for every model provider behind it. promptfoo runs on your machine and sends requests to the proxy as an OpenAI-compatible endpoint, while LiteLLM handles the calls to OpenAI, Anthropic, Gemini, Bedrock, Azure and other providers behind it. The method described here is to configure a promptfoo provider against the proxy's base URL and a dedicated virtual key. The supplied material does not establish a dedicated LiteLLM connector in promptfoo, so confirm the exact provider ID and option names in the current promptfoo introduction before you write the configuration.
Create a dedicated virtual key for test traffic in LiteLLM rather than reusing a production key. Virtual keys in LiteLLM need a PostgreSQL database and can carry per-key budgets, TPM and RPM limits, and a list of allowed models. Restricting the test key to the models your suite actually evaluates keeps a misconfigured run from reaching production-only models, and a budget cap stops a large red team scan from consuming a shared allowance. Store the key in your secret manager and pass it to promptfoo through an environment variable, not in a committed config file. Ask your LiteLLM administrator which model names the proxy exposes, because those names become the model identifiers in your promptfoo provider list.
Keep test traffic out of production logs before the first run. Give test keys their own team or key alias so spend and request logs can be filtered, and confirm with your team whether logging of request content is enabled on the proxy, since red team prompts are deliberately adversarial. LiteLLM's Enterprise tier includes audit logs and team-level logging controls, so check your license before relying on them. Finally, confirm which LiteLLM version your proxy runs against the current release notes, and run one small smoke test against each model in the suite before a full red team scan, so that routing, cooldown or failover behavior does not skew the first results.
What you need before connecting promptfoo to LiteLLM
Connecting promptfoo to a LiteLLM proxy depends on a small set of versions, data stores and secrets on both sides. Confirm each item below in your own environment before you write the first provider configuration, because a gap in any one of them usually shows up as a failed run rather than a clear error.
Node.js runtime for promptfoo
The promptfoo npm release 0.124.1 requires Node.js 22.22.0 or newer. Check the version on every machine and CI image that runs evals, not only on the workstation where the suite was first written. Pin the Node version in your pipeline so a runner image update does not change behavior between runs.
promptfoo on npmLiteLLM release in the supported range
Pick a LiteLLM release from the four most recent stable minor versions, which LiteLLM says it supports for open source and Enterprise deployments. The releases page lists v1.105.1 as published on October 14, 2026. Record the exact version you test against, since provider behavior and routing can change between minors.
LiteLLM releasesPostgreSQL for virtual keys
Virtual keys need a PostgreSQL database, so plan for PostgreSQL before you issue any test key. Confirm who operates the database, where it runs, and how its backups are handled. Test keys with budgets and model restrictions are stored there, so the database belongs in the same change review as the proxy itself.
LiteLLM virtual keys docsRedis once several proxy instances run
A single proxy instance can run without Redis, but once more than one instance runs, shared rate limits, router state and cache need Redis 7.0 or newer. Decide early whether your test traffic shares those instances with production, because shared rate limits can make a red team scan slow down live users or the reverse.
LiteLLM production guideMaster key held in a secret manager
The LITELLM_MASTER_KEY must start with sk- and should live in a secret manager, not in config.yaml, a .env file committed to a repository or a CI variable visible to every job. Confirm who can read it, how it rotates, and that the promptfoo configuration references it through an environment variable rather than a literal value.
Network path from the test runner
The machine or CI runner that executes promptfoo must reach the proxy's listening address and port, and the proxy must reach each upstream provider. Check egress rules, DNS names, TLS certificates and any corporate proxy settings on the runner. Test with a single model request before a full suite, so network failures are not mistaken for model errors.
How to configure the LiteLLM provider and virtual test keys
This sequence connects promptfoo to a LiteLLM proxy through a dedicated virtual key, so every model alias in the suite is reachable and test traffic is budgeted and kept apart from production keys.
Create a team and scoped test key
The LiteLLM administrator creates a team for evaluation traffic in the admin UI or through the proxy's management API, then issues a virtual key for that team. Restrict the key to the model aliases the suite needs, and set a budget along with RPM and TPM limits sized by the test owner. LiteLLM virtual keys require a PostgreSQL database, so confirm that the proxy has one before you start. The step is complete when the key appears under the team and a model list request made with it returns only the permitted aliases.
Set proxy URL and key variables
Store the proxy base URL and the virtual key as environment variables on the machine or CI runner that runs promptfoo, and keep them out of the config file and version control. Use the variable names your promptfoo provider documentation expects, and check the exact names against the LiteLLM and promptfoo docs for your versions. Do not place the LiteLLM master key in these variables, since it grants administrative access. The step is complete when a plain HTTP call to the proxy's model list endpoint, using the exported key, returns the expected aliases.
Define one provider per model alias
In the promptfoo configuration file, usually
promptfooconfig.yaml, add one provider entry for each LiteLLM model alias the suite will test. Point each entry at the proxy base URL through the environment variable, and use the alias name exactly as the proxy publishes it, not the upstream vendor model name. Keep aliases in a single list so that adding or removing a model changes one place. Confirm the provider identifier format in the promptfoo provider documentation before you write it. The step is complete when promptfoo lists every configured provider without parse errors.Run a smoke eval per alias
Run a single prompt with a trivial assertion against each configured alias, one at a time, so failures are easy to attribute to a specific route. Watch the proxy logs and the test key's spend to confirm that requests arrive under the test team and not under a production key. If an alias fails, check whether the model is restricted for the key, whether the budget is exhausted, or whether the router has placed the deployment in cooldown. The step is complete when every alias returns a response and the usage appears against the test team.
Run the full evaluation suite
Run the complete suite across all configured aliases, starting with a small test case subset if your budget is tight. Check the RPM and TPM settings against the rate of requests the suite produces, because limits that are too low will show up as throttled or failed calls rather than as model quality problems. Record the run's output and the proxy's usage totals so the team can compare spend with the budget. The step is complete when the run finishes and the results file, along with the team's usage figures, can be reviewed together.
Confirm gateway logs stay separate
Verify that test traffic is logged under the test team and virtual key, and that production applications use their own keys and teams. Ask your platform owner which logging destination the proxy uses and who can read it, since LiteLLM's audit logs and team-level logging controls depend on the edition you run. Document the key rotation and budget owner so the test key does not outlive its purpose. The step is complete when a report of the test team's logs contains no production key identifiers and the owner has signed off on access.
How LiteLLM routing changes what your tests measure
When promptfoo sends traffic to a LiteLLM proxy, the model name in your config is an alias, not a single deployment. The LiteLLM router can use simple-shuffle (the recommended mode), usage-based, latency-based, least-busy or cost-based routing, and it adds retries, cooldowns after repeated failures and priority ordering for failover. Two runs using the same alias can therefore reach different backends, regions or accounts, and the scores you compare may describe different systems. Before a comparison run, confirm in your config.yaml model list which deployments sit behind each alias and which routing setting the proxy uses in its router configuration.
For comparison runs, pin each alias you evaluate to one known deployment, or give the test a dedicated alias that routes to a single backend. Record the routing mode, the fallback order and the deployment chosen alongside the promptfoo results, so a later rerun can be matched to the same conditions. Ask your platform team whether session affinity or priority failover is enabled on the proxy, since either can change which backend answers a given test. Keep the pinned configuration under version control with the eval suite so changes to routing are visible in review.
Cooldowns deserve particular attention. After repeated failures, the router stops sending traffic to a deployment for a period, so a run may send its requests to a remaining backend or return errors that look like provider failures. A spike in refusals, timeouts or quality drops in one run can come from a cooldown rather than from the model. Check the proxy logs for cooldown or retry events for the affected time window before you attribute a regression to a model. The current routing and retry behavior is described in the LiteLLM routing documentation, and you should confirm the settings your proxy version actually uses.
Mapping promptfoo test traffic to LiteLLM keys, teams and models
This table maps each promptfoo concept to its LiteLLM counterpart and explains why the test object should stay separate from production traffic. Read each row as a decision: the LiteLLM object on the right is what you create, and the reason column tells you what would go wrong if you shared it with production. The main takeaway is that test runs should have their own team, keys, model restrictions and grader budget so spend, logs and rate limits never mix with live applications.
| promptfoo concept | LiteLLM object | Why keep it separate from production |
|---|---|---|
| Test suite (one config and its test cases) | Team, with its own budget and member list | Team budgets cap test spend and keep suite runs out of production cost reports |
| CI pipeline or developer runner | Virtual key issued to that runner, scoped to the team | A leaked CI key can be revoked without rotating production credentials |
| Model alias in the promptfoo config | Model restriction on the virtual key | Limits a test key to the models the suite is meant to hit, so a misconfigured provider entry cannot reach production models |
| Grader model (LLM-as-a-judge) | Separate virtual key with its own budget and rate limits | Grading calls can be numerous, so a dedicated budget stops them from exhausting the keys used by the systems under test |
| Red team scan volume | Per-key TPM and RPM limits on the test key | Scans can burst traffic, so rate limits protect shared quotas that production depends on |
| Gateway logs for test calls | Logs tagged to the test team and key, reviewed in the admin UI or your log store | Keeps test prompts, including attack payloads, out of production log retention and access reviews |
| Temporary budget increase for a large scan | Time-limited budget raise on the test key only | Confirm with your platform team that the increase expires, so an unfinished run does not leave spend open |
Keeping test keys, budgets and logs apart from production
Promptfoo suites send many requests, often with adversarial prompts, so they should not share keys, budgets or log streams with production traffic. The cards below cover the controls that separate the two, and the license features you need to confirm before relying on them.
Scope a virtual key to test traffic
Create a dedicated virtual key for promptfoo runs rather than reusing an application key. Set a per-key budget and TPM and RPM limits so a runaway red team scan or a misconfigured retry loop stops at a known ceiling. Restrict the key to the models the suite needs. Virtual keys require a PostgreSQL database, so confirm that your LiteLLM deployment has one before planning this step.
Virtual keys docsRestrict test keys to non-production models
Allow the test key only the model aliases defined for evaluation, such as a staging alias that maps to a cheaper or sandboxed deployment. Keep production model names out of the test key's allowed list. This stops a misplaced config file from sending adversarial prompts to a production model, and it keeps spend on test models visible in one place.
Hold the master key in a secret manager
Keep LITELLM_MASTER_KEY, which must start with sk-, and each provider credential in a secret manager rather than in promptfoo config files or CI variables that anyone with repository access can read. Your deployment may use a secret manager integration, which is an Enterprise feature, so confirm your license. Otherwise inject secrets through your platform's own mechanism and document who can rotate them.
Production best practicesTag test requests for log filtering
Attach a consistent tag or metadata field to every request the promptfoo suite sends, and use the same value in the eval config for each run. With that tag, gateway logs can be filtered so test prompts and responses never mix with production analytics or retention policies. Verify that your LiteLLM version passes the metadata field you choose through to its logs before you rely on it for filtering.
Confirm which controls your license covers
Audit logs, organization and team RBAC, IP allowlisting and secret manager integrations are Enterprise features in LiteLLM. Admin UI SSO is free for up to 5 users from v1.76.0, and an Enterprise license is needed beyond that. Confirm with LiteLLM which of these your license covers before you design the separation model, because the answer changes who can see test logs and who can change test budgets.
LiteLLM Enterprise docsQuestions teams ask before connecting promptfoo to LiteLLM
Can our own team connect promptfoo to a LiteLLM proxy without outside help?
Yes, a team with LiteLLM admin access and someone who already runs promptfoo can point a suite at the proxy, because promptfoo runs locally and talks directly to the endpoint. The work that usually needs more time is the design: deciding which models sit behind the gateway, how test keys are scoped, and how gateway logs stay apart from production. If your team has not run LiteLLM in production before, confirm who owns the PostgreSQL database and the virtual key setup before you start. An outside partner adds value mainly when the design must be reviewed by security or compliance staff.
What makes the effort grow when we connect promptfoo to LiteLLM?
Four factors drive effort most. The first is the number of models and providers behind the proxy, since each one needs a model name, routing choice and a tested response format. The second is provider credentials, meaning how many keys the proxy holds and how they are rotated. The third is identity design, which covers who may create virtual keys and whether SSO is needed for the admin UI. The fourth is log separation, because test traffic must be tagged or routed so it does not mix with production spend and logs. A small single-provider setup with one test key is far simpler than a multi-team gateway.
What do we need to provide before work starts on a LiteLLM test setup?
You need admin access to the LiteLLM proxy so virtual keys and model routes can be created, and a PostgreSQL database, since virtual keys depend on it. You also need the provider keys or cloud identities the proxy uses, and a decision on which of them may serve test traffic. Network paths matter: the machine running promptfoo must reach the proxy, and the proxy must reach each provider endpoint. Finally, you need an agreed test budget per key, covering spend and request limits, so a red team run cannot exhaust production quota. Confirm each item with your own platform owners before the scope is fixed.
How long does a LiteLLM and promptfoo setup take?
The duration depends on scope, and no fixed figure applies to every organization. A proof of concept with one or two providers, one virtual key for tests and a single suite is the shortest path. Duration grows with the number of providers, the number of teams that need separate keys, the identity integration, and the time your security team needs to review the design. Ask for a written timeline tied to the agreed scope, and ask which dependencies sit with your team, such as access approvals, database provisioning or change windows.
Do the promptfoo and LiteLLM licenses allow us to use them this way?
promptfoo is licensed under the MIT license, and its documentation describes it as running completely locally, so using it against a LiteLLM proxy you operate is within the license. LiteLLM is dual licensed: content under its enterprise/ directory uses the license in enterprise/LICENSE, and everything else is under the MIT license. Features such as SSO beyond the free user limit, audit logs and SCIM fall under Enterprise terms, so confirm which features you need before relying on them. Have your legal team read the license files directly, since this summary does not replace that review.
Will DeployOpen run the promptfoo suite continuously after setup?
Ongoing runs are available as a retainer, and they are scoped separately from the initial build. Continuous testing covers scheduled suite runs, reviewing changes to models and routes behind the proxy, updating test keys and budgets, and keeping the suite working as LiteLLM versions change. Whether a retainer fits depends on how often your models change and who reviews the results internally. Ask for the agreed run frequency, reporting format and upgrade handling in writing before you sign.
How do we keep test traffic out of production logs and spend?
Give test traffic its own virtual keys, with per-key budgets and request limits, and restrict those keys to the models the suite needs. Route promptfoo through the proxy using only these keys, so spend and logs can be filtered by key or team. Keep production keys out of the promptfoo configuration and store all keys in a secret manager, since LiteLLM recommends keeping its master key there. Confirm with your security team how long gateway logs are retained, who can read them, and whether test prompts containing sensitive data need redaction before they are written.
Common failures when promptfoo calls a LiteLLM proxy
This table lists the failures teams most often hit when promptfoo sends test traffic through a LiteLLM proxy, with the likely cause and the fix for each. Read it before the first full run, and again when a suite fails for reasons unrelated to model quality. Most of these failures come from key scope, proxy configuration or shared limits, so check those first.
| Failure | Likely cause | Fix |
|---|---|---|
| Authentication error from the proxy | The key does not start with the expected prefix, or the virtual key lacks access to the requested model. Keys with restricted model lists reject other models. | Confirm the key format against your proxy's key settings, then list the models the key is allowed to call. Issue a test key scoped to exactly the models in the suite. |
| Model alias missing from the proxy config | The promptfoo provider ID names a model_name that does not appear in the proxy's model list, often after a rename or a copied config from another environment. | Compare the model names in the promptfoo config with the proxy's configured model list. Use the same alias in both places and retest one case per model before a full run. |
| Budget or RPM limit hit mid-run | A per-key, per-user or per-team budget or TPM/RPM limit is reached partway through a red team or eval run, so later requests fail even though earlier ones passed. | Set the test key's limits before the run based on the planned request volume, and ask the proxy owner for a temporary budget increase for scheduled scans. Watch remaining budget during long runs. |
| Cooldown after repeated provider failures | The router places a deployment in cooldown after repeated errors, such as rate limiting or timeouts, so promptfoo receives failures for a model that is still reachable. | Check router logs for cooldown events. Reduce concurrency in promptfoo, add retries with spacing, or confirm that a fallback deployment exists for the affected model. |
| Database unavailable, blocking virtual keys | Virtual keys depend on PostgreSQL. If the database is down or unreachable, key validation fails and every promptfoo request is rejected, including traffic that is not under test. | Check database health and connectivity from the proxy pods first. Ask the platform team to confirm the database has its own high availability and backup plan, and do not run scheduled scans against a database under maintenance. |
| Gateway logs mix test and production traffic | Test runs share the proxy, keys and log sinks used by production applications, so spend, traces and request records cannot be separated by purpose. | Issue dedicated test keys and team labels for promptfoo, route their logs to a separate project or index, and confirm with the logging owner how retention and access differ for test data. |
How a test request travels from promptfoo through LiteLLM
A test request starts in the promptfoo runner, which reads the test config and sends it to the LiteLLM proxy using a virtual key reserved for test traffic. The proxy checks that key, then the router picks a provider endpoint. The proxy uses PostgreSQL for virtual key and budget state and Redis once more than one proxy instance runs. Check that the test key cannot reach production keys, budgets or logs.
Test and production traffic share one proxy but use separate keys and logs.
Verifying the connection before you trust the results
A promptfoo run through LiteLLM is only as trustworthy as the path it took to reach the model. The checks below confirm that the right models answer, that test traffic uses its own key, that guardrails at the proxy actually fire, and that routing stays stable, so that a failing or passing result means what it appears to mean.
Confirm the proxy model list
Compare the model names the proxy reports against the aliases in your promptfoo configuration before running anything else. Each alias should map to the intended provider and deployment, and any alias missing from the list should stop the run. Ask your gateway operator to confirm which aliases the test key can reach, since a key restricted to specific models will fail on the others in ways that look like model errors.
Virtual keys docsOne-prompt smoke test per alias
Send a single short, known prompt to every alias in the suite and record the status code, the model name in the response and the latency. This separates connection and authentication problems from grading problems. If a response reports a different model than the alias implies, treat the mapping as wrong until the gateway configuration explains it.
Check that logs show the test key
Open the gateway's request logs after the smoke test and confirm that every request is attributed to the virtual key created for testing, not to a production key, user or team. Requests attributed to production identities mean the configuration is leaking traffic into production budgets and dashboards. Keep this check on the checklist for every new environment, because a copied configuration file often carries the wrong key.
Probe guardrails at the proxy
Run a small red team scan through the proxy, not directly against the provider, and confirm that the guardrails configured at the gateway block the probes you expect. A probe that succeeds on the proxy path but fails on the direct path points to a gateway policy that is missing or misapplied. Record the probe set so the same scan can be repeated after any gateway change.
Rerun a known case for routing stability
Repeat a case with a known expected answer several times and confirm that the proxy returns the same provider and model each time. If the router spreads requests across deployments, results can vary between runs for reasons unrelated to the model under test. Check the routing strategy and any cooldown or failover settings before you compare scores between runs.
LiteLLM routing docsWhat a DeployOpen engagement covers for this integration
A DeployOpen engagement for this integration is a fixed-scope piece of work, with scope, deliverables and timeline agreed in writing before anything is built. The first decisions are the model list and the key and log design: which providers and model aliases the LiteLLM proxy exposes to the test suite, which virtual keys carry test traffic, which team or user owns each key and budget, and where gateway logs go. Those decisions set the shape of everything after them, so they are agreed with your security, platform and AI teams before configuration starts. The output of this stage is a short written design that names each key, its model restrictions and its log destination.
Next comes the build. This covers the promptfoo configuration that points at the proxy, the provider entries for each model alias, the CI wiring that runs the suite on the pipeline you already operate, and the first full run against the test keys. The first run is where you find out whether routing, budgets and logging behave as the design says, so the engagement includes reviewing those results with your team. The handover includes the configuration files, the key and log runbook, and notes on how to rotate keys and add a model. Ask any provider to state which of these artifacts you receive and in what form.
Ongoing testing is available as a retainer for teams that add models, change routing or run regular red team scans against the proxy. A retainer covers the work agreed in its own written scope, so confirm what is included before signing, including how model and key changes are requested and how retests after fixes are handled. Pricing is set from the written scope, and DeployOpen does not publish a price list, so ask for a quote built from the model list, the number of teams using keys and the pipelines involved.
How DeployOpen scopes and delivers LiteLLM and promptfoo work
DeployOpen plans, deploys and hands over the LiteLLM gateway and the promptfoo test setup that sits in front of it, inside infrastructure you control. Each engagement starts from a written scope that names the providers, virtual keys, databases and identity settings involved.
How we scope
- Inventory the model providers, deployment names and approved endpoints the test suite must reach through LiteLLM.
- Decide which virtual keys, budgets and model restrictions test traffic gets, separate from production keys.
- Agree in writing whether the proxy uses PostgreSQL and Redis, and which SSO and log destinations apply.
How we build
- Deploy the LiteLLM proxy with PostgreSQL, keeping the master key in a secret manager rather than in config files.
- Configure promptfoo providers that point at the proxy, then run a smoke suite to confirm each model route answers.
- Tag test traffic and route its gateway logs to a separate store so evaluation runs never mix with production records.
How we hand over
- Document provider IDs, virtual key scopes, budget settings and the promptfoo config layout for your team.
- Provide a runbook for rotating test keys, adjusting rate limits and recovering the proxy after a failed upgrade.
- Walk your engineers through a full suite run and the log queries that confirm test and production traffic stay apart.
How we support
- Offer ongoing upgrades, monitoring and continuous testing as a retainer after handover, scoped in writing.
- Plan LiteLLM upgrades against its supported minor versions and retest the promptfoo suite after each change.
- Confirm with your team which Enterprise features, such as SSO beyond the free user limit, your organization needs before work starts.

