Why test a new model on LiteLLM traffic mirroring before switching
A candidate model that wins on public benchmarks can still underperform on your traffic. Benchmarks rarely reflect your callers' prompts, document formats, languages, tool calls or the length of the conversations your applications actually send. The platform team's question is therefore not whether the new model is good in general, but whether it answers the requests your organization makes today at an acceptable cost and latency. LiteLLM traffic mirroring lets you answer that question with live requests. The gateway sends a copy of production traffic to a secondary model named by the silent_model setting, in the background. The silent model's response does not affect the latency or result of the primary request, so callers keep getting the answer from the model they already use while you collect evidence on the candidate.
Teams usually need this before changing the default model for a high-volume route, before moving a workload to a different provider, or before replacing a self-hosted model with a hosted one. Mirrored results let you compare answer quality, token cost and response time on the same prompts, which is the comparison a benchmark cannot give you. Before you enable it, confirm with your gateway administrator which routes and keys will be mirrored, and check the traffic mirroring documentation for the current configuration keys and any limits on mirrored requests. Mirroring also creates a second copy of prompts and responses sent to a second provider, so confirm that the candidate provider is approved for that data and that the mirrored requests appear in your logs and spend records as you expect.
Mirroring does not replace a structured evaluation, a security review of the candidate, or a controlled rollout. It shows how a model behaves on requests you already receive, but it does not score answers against your acceptance criteria, check for prompt injection or unsafe output, or confirm that the model meets your data residency and retention requirements. Mirrored outputs also need a reviewer or an evaluation method to judge them, and the silent model's behavior under your normal rate limits and budgets should be confirmed in your own environment. Plan these checks alongside mirroring, then move to a gradual switch once the evidence supports it.
Mirroring configuration options and when each fits
This table compares the decisions a team makes when configuring LiteLLM traffic mirroring: which primary route to copy, which candidate becomes the silent model, how much traffic to mirror and where mirrored results are recorded. Read each row as a question to answer before enabling mirroring, and confirm the exact setting names in the traffic mirroring documentation for your LiteLLM version.
| Decision | Options to weigh | When it fits | Confirm before use |
|---|---|---|---|
| Primary route to mirror | One high-volume model alias, or several aliases used by different teams | One alias keeps the comparison clean; several aliases need separate candidate comparisons per caller group | Which model alias the mirror attaches to and that callers keep using the primary alias |
| Silent model candidate | A new provider model, a self-hosted model, or a newer version of the current model | A candidate that a team already trusts enough to receive copies of real prompts under its data handling terms | The candidate's provider terms and region permit receiving production prompts |
| Full or sampled mirroring | Mirror every request, or mirror a fraction of requests | Full mirroring suits low volume or short tests; sampling suits high volume where cost and provider limits matter | Whether the docs support a sampling rate and how it is configured in your version |
| Mirror logging destination | Shared spend logs, the candidate's own log tag, or a separate team logging destination | Separate logging keeps candidate spend and outputs apart from production reporting and budgets | Where mirrored requests and responses are recorded, and how they appear in spend reports |
| Response isolation check | Confirm the caller always receives the primary model's response | Required for every test, since the silent model must not change what callers see | Test latency and errors with the candidate deliberately slowed or failing in a non-production environment |
| Prompt and response retention | Keep mirrored content, store metadata only, or disable storage for the candidate | Metadata-only storage fits tests with sensitive prompts; full storage fits evaluation that needs outputs later | Your spend log and prompt storage settings for mirrored requests and their retention period |
Setting up a silent model test on a self-hosted gateway
This sequence adds a candidate model beside your current production route, mirrors a copy of live requests to it, and confirms that callers still receive only the primary model's response. The output is a gateway where you can compare candidate quality, cost and latency on real traffic without changing what users see.
Confirm the gateway version and data stores
The platform owner checks that the running LiteLLM release is on a supported minor version and that the deployment matches the production guide: PostgreSQL as the database, and Redis 7.0 or newer once more than one proxy instance runs, since shared router state and rate limits depend on it. Record the image tag, the database and Redis versions, and the number of proxy replicas, so that any later latency or error change can be traced to the test and not to a baseline drift. The step is done when the versions are written into the change record and the proxy health checks pass on every replica. The current release list is on the LiteLLM releases page.
Capture a production baseline before mirroring
Before any mirror is configured, the platform team records latency, error rate and token usage for the primary route over a representative window of normal traffic. Use the gateway's existing logs or metrics pipeline, and split the numbers by model, team and key so the comparison later is like for like. Ask the vendor or your internal owner which latency percentiles and error categories your monitoring already tracks, and confirm they cover the primary route. The step is complete when you have a saved baseline that the team agrees reflects normal load, including any peak periods you expect to repeat.
Add the candidate model as a route
The platform engineer adds the candidate model to the gateway configuration as its own model entry, using the provider credentials and cost settings that the candidate's provider requires. The entry is restricted so that only the platform's test key and the mirror path can reach it, and no application key is granted access yet. Keep the candidate name distinct from the production alias so that neither callers nor dashboards confuse the two. The step is done when a direct test request to the candidate returns a valid response through the gateway, and the request appears in the logs under the candidate's model name.
Configure the mirror on the primary route
The platform engineer adds the mirror setting to the primary route so that a background copy of each request is sent to the candidate, as described in the LiteLLM traffic mirroring documentation. The configuration names the silent model explicitly and is kept in version-controlled configuration so it can be reviewed and reverted. Confirm the exact key names and any sampling or filtering options against the current documentation for your release, because they can change between minor versions. The step is done when the configuration is deployed to all replicas and a reviewer has approved the diff.
Verify that callers receive only the primary response
The QA or platform team sends controlled test requests through the production route and checks that every response body, status code and returned model field matches the primary model alone. Confirm that the candidate's output never appears in the caller's response, including during candidate timeouts or errors, which the mirror is designed not to affect. Run the same test with a deliberately failing candidate route to confirm that primary responses are unaffected. The step is complete when these checks pass and the results are recorded as evidence for the change.
Compare latency and error rates with and without mirroring
Run the baseline comparison again with mirroring enabled, over a window of similar traffic, and compare primary-route latency percentiles, error rates and retry counts against the saved baseline. A material increase in primary latency or errors means the mirror is affecting the production path, so the step includes a clear rollback decision: remove the mirror setting and redeploy. Check the candidate's own error rate separately, since failures there are expected to be recorded without reaching callers. The step is done when the platform owner signs off that primary metrics are within the agreed tolerance, which should be set by your team before the test starts.
Review candidate quality and cost before switching
The evaluation team compares the mirrored candidate outputs with the primary outputs for the same requests, using the quality checks your team already trusts, and reviews token usage and cost per request from the spend records. Keep stored prompts and responses within the retention and privacy settings your organization has approved, and confirm that the candidate's provider is permitted to receive this data before the mirror runs. The output is a written decision: switch, extend the test, or reject the candidate, with the quality, cost and latency evidence attached. Only after that decision should you change the production alias or remove the mirror.
How the primary response and the mirrored copy separate
The diagram starts with the caller's request reaching the LiteLLM proxy, which forwards it to the primary model and returns that response immediately. In the background, the proxy also sends a copy to the silent model, whose output goes to the logging and evaluation store and never reaches the caller. Check that the trust boundary around provider calls matches where your prompts may leave your network, and that the evaluation store has the same retention and access rules as your other prompt logs.
Caller response path and background mirror branch, with the provider and logging boundaries marked.
What to compare: quality, cost and latency for the candidate
Quality is the hardest dimension to compare because mirrored responses are not scored automatically. Start by defining the task types in your traffic, such as summarization, classification, code generation or customer answers, and sample records from each. Pair every sampled primary response with its silent counterpart using the same request identifier so the two outputs can be read side by side. Judge them with reviewers who know the task, or with an evaluation tool that scores outputs against rubrics you write. Agree on the rubric before looking at results, and record reviewer disagreements instead of averaging them away.
- Pair records by request identifier: Keep the primary and silent logs linked so each comparison uses the same prompt and input context.
- Store both outputs together: Confirm with your team whether prompts and responses are kept in the spend log for your configuration, since that decides where the text is read from.
- Write task-specific rubrics: Define what a correct, complete or acceptable answer looks like for each task type before reviewing.
- Use blinded review: Hide which output came from the candidate so reviewers judge content, not familiarity.
- Track disagreement: Record cases where reviewers split, since they often show where the rubric is unclear.
Before relying on any score, confirm with your reviewers and evaluation tool owners that the sample covers the traffic you intend to switch.
Cost comparison depends on token counts and the price each provider charges for them, so it should come from recorded usage rather than estimates. For each mirrored request, compare the input and output tokens of the primary and silent responses, then apply the price each model is configured with in your gateway. LiteLLM's cost tracking records spend per request, but the figures should be reconciled against the provider invoices or usage exports for the candidate before you trust them. Remember that the silent request is an additional call you pay for while the mirror runs, so include that in the total cost of the test.
- Token usage per request: Compare prompt and completion tokens for the same input, since a cheaper model can produce much longer outputs.
- Computed spend per request: Use the spend the gateway calculates, and confirm the model price configuration matches the provider's current published rates.
- Mirror overhead: Measure the extra spend created by sending the silent copy, which is separate from the cost of the switch itself.
- Failed and retried calls: Check whether errors or retries generated billable tokens on either side.
- Reconciliation to invoices: Match totals by model and date to provider billing to catch pricing or tagging gaps.
Ask your provider and gateway administrators to confirm the pricing data used in the calculation before comparing totals.
Latency measures how long callers wait, so the primary and silent timings must be read separately. LiteLLM's traffic mirroring runs the silent model in the background, and its response does not change the latency or result of the primary request. That means the caller's timing reflects the primary model only, and the silent timing shows what the candidate would have taken. Compare time to first token and total completion time, and look at the spread as well as the average, because tail latency is what users notice on slow calls. Keep in mind that the silent request may be slower or faster in your environment than it would be in a direct production route, so confirm how your gateway timestamps each call.
- Timing fields per call: Pull request start, first token and completion timestamps from the logs for both the primary and silent requests.
- Percentile comparison: Compare median and high-percentile values, since averages can hide slow outliers.
- Time to first token for streaming: Measure this separately for streamed responses because it drives perceived responsiveness.
- Time-of-day breakdown: Group results by hour to see whether peak load changes the candidate's behavior.
- Timeouts and cooldowns: Record how often the silent call timed out or failed, since a slow candidate may fail more often under load.
Confirm with your platform team which timing fields your LiteLLM version records before building the dashboard.
Safety and format compliance checks whether the candidate's outputs can be used by your application and whether they meet your policies. Format problems, such as invalid JSON, missing fields or changed tool-call structure, often break downstream systems even when the text reads well. Safety checks cover harmful content, policy violations, data leakage and personal data that appears in responses. Run these checks on the silent outputs with the same validators you use for production, and compare failure rates against the primary model. Treat any silent output that would have reached a user with a policy violation as a blocking finding for the switch decision, and have a security reviewer confirm how such cases are handled.
- Schema validation: Run the same JSON or schema checks on both outputs and count parse failures and missing fields.
- Tool-call structure: Compare function names, argument shapes and call counts where the application depends on them.
- Policy and content screening: Apply your existing guardrails or classifiers to both sets of outputs and compare flag rates.
- Personal data in outputs: Check whether the candidate repeats or introduces personal data that the primary model does not.
- Refusal and error patterns: Record refusals, truncated responses and empty outputs, which often matter more than average quality.
Before the test starts, ask your security and compliance owners to confirm which checks are required and who reviews flagged records.
Data exposure and controls when mirroring real prompts
Mirroring sends copies of real prompts and responses to a second model, so the mirror path needs the same data controls as the primary path. The cards below cover where mirrored data travels, what it leaves behind in logs, how the silent model's keys are bounded, and who can read the comparison results.
Mirrored prompts reach a second provider
A silent model may run on a different provider or in a different region from the primary model, so a copy of every mirrored prompt can leave the boundary your current model approval covers. Before enabling mirroring, confirm the candidate provider's data handling terms, hosting region and retention for API traffic, and check them against your approved provider list. Treat the candidate as a new data flow, not a free test.
Traffic mirroring docsPersonal data copied into logs
Mirroring doubles the places where personal data can land, because the mirrored request and its response can be written to spend logs and logging callbacks. Decide whether prompts and responses are stored for the silent model at all, and apply the same masking or logging rules you use on the primary path. Confirm this with a test request containing dummy personal data before real traffic is mirrored.
Silent model keys need hard limits
The candidate model should be reached through its own virtual key, not the key used by production callers, so its spend cannot grow unnoticed. Set a budget, TPM and RPM limits, and restrict the key to the candidate model only, so a misrouted or looping mirror cannot call other models. Review those limits before the test starts and again when it ends.
Virtual keys docsComparison results need an access model
Quality scores, cost comparisons and stored responses from a mirror test often contain the same sensitive content as the original prompts, so they should not sit in an open dashboard. Assign the people who review results to the same team and role model that governs the production traffic. Confirm who can read logs, evaluation outputs and exported files, and remove access when the test closes.
Mirror failures must not leak
A mirror that fails, times out or returns errors should never change what the caller receives, and its error text should not expose prompt content in shared alerts. Check that failures in the silent model are recorded with metadata only, and that alerts route to the team that owns the test. Confirm this behavior with a deliberate failure in a staging environment before production use.
Questions teams ask before testing models with traffic mirroring
How much effort does a traffic mirroring test take?
The effort depends mostly on how many candidate models you compare, how much traffic you mirror, and how much evaluation work you need to judge the results. The mirror itself is configuration on a gateway you already run, so the larger share of work is usually setting up the candidate route, agreeing on what counts as a better answer, and reviewing the mirrored results. No duration figure was supplied for this work, so ask any partner for a written scope that lists the number of candidate models, the traffic window, the evaluation method and the report format before agreeing to a timeline.
Can our in-house team run a model comparison with LiteLLM mirroring?
Yes, if your team already operates the LiteLLM proxy and can add a candidate model route to its configuration. The mirror sends a copy of real requests to a secondary silent_model in the background, so the work that falls on your team is the evaluation: defining scoring criteria, reviewing outputs, comparing cost and latency, and deciding who signs off. Teams without a running gateway or without evaluation experience usually need help with the platform setup first. Check the LiteLLM traffic mirroring documentation against the version you run before you plan the configuration.
What does the test need from our side?
Plan for four inputs before the test starts. You need access to the candidate model's provider account or self-hosted endpoint, with credentials stored in your secret manager. You need written evaluation criteria covering quality, cost and latency, plus a named reviewer for the results. You need a place to store the mirrored request and response logs, and a decision about how long they are kept, since those logs may contain prompts with personal data. Finally, you need a window of production traffic that is representative of your callers. Confirm each of these with your security and compliance teams before traffic flows to a new provider.
Does traffic mirroring slow down the response our callers receive?
According to the LiteLLM traffic mirroring documentation, the mirrored request runs in the background, and the silent model's response does not affect the latency or result of the primary request. Callers still receive the response from the primary model. Your own measurements should still confirm this in your environment, because the mirror adds work to the gateway itself, such as extra provider calls, logging and database writes. Track gateway latency and error rates during the test window, and compare them with a baseline taken before mirroring starts.
Does the mirrored copy send our data to a new provider?
Yes. A mirrored request is a real production prompt sent to the candidate model's provider or endpoint, so the candidate must be approved for the data class in those prompts before mirroring begins. Review the provider's data handling terms, the region where processing occurs, and whether prompts or responses are stored in your gateway logs. If the prompts contain personal or health data, decide on masking or on a restricted route before any copy is sent. This is a control decision for your own compliance and privacy teams, and it should be settled before the test, not during it.
How do we decide when to switch to the new model?
Switch when the candidate meets the written criteria you agreed before the test: quality on your own task types, cost per request at your real token volumes, latency within your service targets, and no new failure patterns in the logs. Compare results by request category rather than as one average, so that a strong overall score does not hide weak results on sensitive workloads. Record the decision, the evidence and the approver. Plan a staged rollout with a routing fallback to the current model, so you can return traffic quickly if production behavior differs from the mirrored results.
Can a partner run the test and deliver the findings for us?
DeployOpen plans, implements and supports self-hosted open-source platforms inside your own infrastructure, including self-hosted LiteLLM gateways. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope. DeployOpen does not publish a price list. Ask any partner to specify the candidate models, the evaluation method, who reviews the results, and how the mirrored logs are stored and deleted, since those choices drive both cost and risk.
How DeployOpen scopes and delivers a model mirroring test
DeployOpen plans a candidate model test in writing before any configuration changes, and where the scope is clear enough we agree it as a fixed-scope engagement. The written scope names the primary and candidate routes, the silent_model entry that receives the mirrored copy, the sampling share of production traffic, the evaluation criteria (quality checks, cost per request, latency percentiles and error rates) and who signs off the result. It also records which request fields the candidate may see, how mirrored requests are tagged in logs, and when the test ends. Deliverables usually include the configuration as code, the evaluation method, a findings summary and a handover session for your platform and application teams. The exact effort and timeline depend on how many routes are tested and how much evaluation work your team wants us to build, so ask for a quote against a written scope rather than a generic estimate.
Scoping also covers the controls that make a mirror safe to run. Because the mirrored copy is a full request sent to a second provider, the engagement checks which teams, keys and data classes will be included, confirms that the candidate provider is approved for that data, and sets log destinations for the mirrored traffic separately from the primary traffic. We deploy the self-hosted LiteLLM proxy in your own cloud accounts, data centers or restricted network, with PostgreSQL and Redis configured for the environment, so that prompts, responses and logs stay where your security and compliance teams already review them. Ask us to show how mirrored spend is attributed, since it will appear on provider bills even though callers never see the response.
Once the test closes, the handover covers what your team needs to keep using the setup: the configuration, the evaluation scripts, the runbook for turning mirroring off, and the records of what was logged. If you need continued help with model comparisons, provider changes or upgrades to the LiteLLM release line, DeployOpen offers ongoing support through retainers, scoped in writing in the same way. We deliver this work as an independent implementation partner. We are not an official LiteLLM partner or reseller, so any vendor support terms come from the vendor directly, and you should confirm those terms for your edition before you rely on them.

