QVeris
PRODUCTION MIGRATION RUNBOOK

Switch LLM Providers Safely

Treat provider changes as behavioral migrations. Compare protocol and model semantics, replay real workloads, canary by risk, and keep rollback ready.

Published: March 24, 2026 · By the QVeris Team

Financial market workflow supporting Switch LLM Providers Safely 安全切换 LLM 供应商

TL;DR

Direct answer: switch LLM providers through a reversible migration, not a one-time code edit. Freeze the current baseline, inventory dependencies, build a behavior-level compatibility matrix, evaluate representative workloads, dual-run both providers, release a risk-bounded canary, and keep the old route hot until rollback has been rehearsed.

Inventory before editing code

Find every model, endpoint, SDK, key, prompt, tool, schema, stream, policy, data term, dashboard, and billing dependency.

Compatibility is behavioral

The same JSON can produce different tool calls, structured output, stream events, safety outcomes, errors, usage, latency, and cost.

Dual runs reveal real differences

Replay approved production-shaped requests through both paths and compare structural, semantic, operational, and economic evidence.

Rollback is part of cutover

Keep credentials, routing, quotas, dashboards, support contacts, and runbooks ready until the stability window and rollback drill pass.

Define the migration scope and success criteria first

“Switch providers” is too broad to execute. Decide whether the project covers one model, one workload, all text generation, embeddings, image or audio endpoints, fine-tuning, batch jobs, or an entire provider account. Name the business reason: availability, price, capability, region, contract, latency, or supplier risk. That reason determines which tradeoffs are acceptable.

Success dimensionExample acceptance criterionRollback trigger
Task qualityNo material regression for priority cohorts; critical invariants always passCritical tool, schema, or safety failure exceeds threshold
ReliabilityCompletion and error rates meet the current SLO under expected loadTimeout, rate-limit, or partial-stream rate breaches gate
PerformanceTime to first token and total latency stay within cohort budgetsTail latency harms the user-facing objective
EconomicsAccepted cost per successful task improves after retries and reviewCost per accepted outcome exceeds agreed ceiling

Why a base URL swap is not enough

A compatible target may accept the same JSON while differing in model behavior, default parameters, tool calling, structured output, stream events, errors, usage accounting, latency, pricing, policy and data handling. The application can remain syntactically healthy while outcomes regress.

Treat migration as a sequence of reversible gates: inventory, compatibility matrix, golden tests, dual run, diff, canary and rollback-ready cutover. Each gate has workload-specific acceptance criteria and named owners.

Inventory every dependency the provider owns

Search code, configuration, secret stores, CI, dashboards, runbooks, notebooks, evaluation jobs, and support documentation. Interview the teams that operate the workloads; static search rarely finds manual console settings, provider-side prompts, fine-tunes, batch jobs, allowlists, account limits, or invoice allocation rules.

Application contract

SDKs, endpoint paths, authentication, model names, request fields, streaming parser, errors, retries, response objects, and provider-specific extensions.

Workload behavior

System prompts, templates, tools, JSON schemas, stop conditions, context assembly, conversation state, RAG, multimodal inputs, and output post-processing.

Operations

Rate limits, quotas, keys, regions, dashboards, alerts, status pages, support escalation, logs, traces, budget controls, and incident procedures.

Data and commercial terms

Retention, training use, subprocessors, data regions, deletion, export, pricing dimensions, discounts, commitments, credits, and termination obligations.

Migration gates and exit criteria

GateBest fitVerify before choosing
InventoryComplete map of applications, workloads and operational dependencies.No unknown production caller, key, extension, tool, data policy or billing owner.
Compatibility matrixField-by-field and behavior-by-behavior comparison.Every required gap has a mitigation, typed extension or explicit block.
Golden testsDeterministic workload suites and accepted invariants.Target passes required tools, schemas, streams, errors, safety and output checks.
Dual run and diffCurrent and target execute the same representative traffic.Structural, semantic, usage, latency and cost deltas fit the acceptance envelope.
Canary and cutoverSmall risk-bounded traffic moves with live gates.Quality and SLOs remain stable; rollback switch, evidence and owners are ready.

Compare behavior, not only schemas

Feature semantics

Tools, strict output, reasoning, context, modalities, streaming and stop behavior.

Failure semantics

Timeouts, status codes, error bodies, rate-limit hints, retryability and partial streams.

Operational economics

Native usage units, price dimensions, latency distribution, retries and review cost.

Trust and lifecycle

Data terms, region, retention, safety, versioning, deprecation and support.

Build an evaluation suite from production decisions

A random prompt benchmark cannot prove migration safety. Sample real workload cohorts: short and long inputs, difficult languages, tool-heavy requests, strict schemas, safety-sensitive cases, high-value customers, large contexts, and known failure examples. Remove or approve sensitive data before replay.

Define deterministic invariants separately from subjective quality. JSON must parse, required fields must exist, tool arguments must validate, prohibited actions must not occur, citations must resolve, and side effects must remain disabled. For open-ended quality, use calibrated human review or a validated judge with blind ordering, cohort-level thresholds, and disagreement analysis.

Dual-run safely and compare accepted outcomes

Dual running sends the same approved logical request to the current and target paths. Only one path may own user-visible output or side effects. Tool execution, email, payments, database writes, and external actions must be disabled or idempotent on the shadow path.

Compare normalized evidence and native evidence. Normalized fields make providers comparable—task, status, latency, cost, accepted result—while native fields preserve model identifiers, finish reasons, token categories, safety signals, tool details, and request IDs needed to explain differences.

Canary by risk, not only percentage

One percent of global traffic can still include the most sensitive customer or largest tool action. Start with internal users, reversible workloads, non-regulated data, and customers who agreed to participate. Expand by workload, tenant, region, language, feature, or traffic slice only after live gates remain healthy.

Automatic stop gates should cover critical invariant failures, error and timeout rates, partial streams, tool validation, user correction, support tickets, cost per accepted task, and safety outcomes. A stop gate freezes expansion and routes new traffic back; it should not destroy evidence or immediately decommission the target.

Compare cost per accepted task, not token price

A cheaper model can require longer prompts, more retries, extra validation, more human review, or a second pass. A faster model can reduce infrastructure and user abandonment even when token price is higher. Reconcile provider invoices with gateway or application telemetry before claiming savings.

Economic formula: accepted-task cost = provider charges + retries + gateway or platform fees + evaluation and review + additional infrastructure + failure remediation.

Close data, contract, and lifecycle obligations

Technical cutover does not finish the migration. Export historical usage, invoices, evaluation records, fine-tune artifacts, batch results, prompts, and configuration that must remain available. Confirm which data the previous provider retains, how deletion is requested and evidenced, when credits expire, how commitments terminate, and whether support access remains during the stability window.

Create a model lifecycle record for the new path: provider, account, region, model and version policy, aliases, owners, release date, evaluation bundle, approval, data classification, pricing version, support contact, deprecation source, and replacement plan. A migration that removes one undocumented dependency but creates another has not reduced lock-in.

Keep the old route isolated but usable until final acceptance. “Hot” does not mean it must receive normal traffic; it means credentials, capacity, configuration, network access, monitoring, and staff knowledge remain sufficient to restore service within the rollback objective. Test that state rather than assuming it.

LLM provider cutover checklist

Before dual run

Scope, owners, baseline, compatibility matrix, test cohorts, data approval, target quotas, support contacts, dashboards, and rollback route are ready.

Before canary

Critical invariants pass, side effects are isolated, telemetry reconciles, stop gates are automated, on-call has access, and old capacity remains available.

Before full cutover

Quality, reliability, latency, cost, security, and data handling meet cohort thresholds across the agreed canary window.

Before decommission

Rollback drill passes, invoices reconcile, historical data is exported, retention and deletion obligations are fulfilled, and contracts can close safely.

Run a reversible migration

  • Freeze the current production baseline and collect representative workload samples.
  • Contract-test the target and block unsupported required capabilities before execution.
  • Dual-run with redacted or approved data and store comparable evidence.
  • Canary by workload risk, tenant or traffic slice with automatic stop gates.
  • Keep the previous route hot until the stability window and rollback drill pass.

Put a migration switch above both providers

Applications call a stable workload interface. A versioned route policy sends approved traffic to current, target or dual-run paths. Provider adapters preserve explicit differences. A diff pipeline compares normalized and native evidence. Canary gates change policy gradually; the rollback switch restores the prior route without an application redeploy.

Production rule: do not decommission the prior path until rollback has been exercised under production-like load.

Common LLM provider migration mistakes

Testing only happy-path chat

The migration ignores tools, strict schemas, long context, streaming interruption, multimodal inputs, rate limits, safety cases, and malformed responses.

Changing provider and prompt together

When output changes, nobody can tell whether the model, prompt, routing, temperature, or retry policy caused it.

Shadow traffic with side effects

The target path sends duplicate messages, writes data, calls tools, or creates charges because “shadow” execution was not isolated.

Comparing average quality only

Averages hide failures for important languages, tenants, rare tools, safety cohorts, or high-value workflows.

Canceling the old account early

Credentials, quotas, data export, support access, or capacity disappear before the new path survives a rollback drill.

Assuming OpenAI compatibility means parity

Matching request fields hides differences in supported endpoints, tools, streaming events, errors, token accounting, and provider-specific capabilities.

Keep capability integrations stable during model migration

QVeris sits above the model gateway as the complementary interface for external APIs, tools, services and live data. Keep those capability contracts and trace fields stable while the inference provider changes. This isolates model migration from the real-world integrations an agent depends on.

Switch configuration only after contract evidence passes

Treat a provider switch as a release with an artifact: exact model, endpoint, adapter version, test results, rollout cohort, and rollback target. This separates a reversible route change from an application deployment.

Promotion record
change_id: llm-route-2026-07-21-01
workload: support-answer
from: provider-a/model-snapshot-a
to: provider-b/model-snapshot-b
contract_suite: contracts/support-answer-v4.yaml
evidence: artifacts/support-answer-provider-b.json
canary_percent: 5
success_gate:
  accepted_quality: ">= baseline"
  p95_latency_ms: "<= 8000"
  error_rate: "<= 1%"
rollback:
  alias_map: config/aliases-v18.yaml
  owner: platform-oncall
  • Change one dimension at a time: route, model, prompt, or retry policy.
  • Use shadow traffic only when data terms permit it and outputs cannot cause side effects.
  • Promote gradually and retain evidence for both success and rollback decisions.

Verified implementation reference: OpenTelemetry GenAI conventions.

FAQ

Can migration be only a base URL change?

Only for very simple workloads after tests prove the target preserves every required behavior.

What should be dual-run?

Representative production workloads, especially tools, strict schemas, streams and failure paths.

When can the old provider be removed?

After the stability window, reconciliation, incident review and a successful rollback drill.

More LLM provider migration questions

What is a dual run?

The same approved logical workload runs on both providers, while only one path may produce user-visible output or side effects. Structural, semantic, performance, usage, and cost evidence is compared.

How should migration be rolled out?

Use risk-bounded canaries by workload, tenant, region, language, feature, or traffic slice. Define automatic stop gates and expand only while quality and service objectives remain stable.

How can we reduce provider lock-in?

Use a product-owned workload interface, explicit adapters, stable task aliases, portable prompts and schemas, conformance tests, native telemetry, and a tested routing switch.

Official sources and further reading

Provider APIs and model behavior evolve. Verify the current primary documentation for every endpoint, model, region, quota, safety setting, data term, and deprecation involved in the migration.

PRODUCTION MIGRATION RUNBOOK
Switch LLM Providers Safely

TL;DR

Direct answer: switch LLM providers through a reversible migration, not a one-time code edit. Freeze the current baseline, inventory dependencies, build a behavior-level compatibility matrix, evaluate representative workloads, dual-run both providers, release a risk-bounded canary, and keep the old route hot until rollback has been rehearsed.

Inventory before editing code

Find every model, endpoint, SDK, key, prompt, tool, schema, stream, policy, data term, dashboard, and billing dependency.

Compatibility is behavioral

The same JSON can produce different tool calls, structured output, stream events, safety outcomes, errors, usage, latency, and cost.

Dual runs reveal real differences

Replay approved production-shaped requests through both paths and compare structural, semantic, operational, and economic evidence.

Rollback is part of cutover

Keep credentials, routing, quotas, dashboards, support contacts, and runbooks ready until the stability window and rollback drill pass.

Define the migration scope and success criteria first

“Switch providers” is too broad to execute. Decide whether the project covers one model, one workload, all text generation, embeddings, image or audio endpoints, fine-tuning, batch jobs, or an entire provider account. Name the business reason: availability, price, capability, region, contract, latency, or supplier risk. That reason determines which tradeoffs are acceptable.

Success dimensionExample acceptance criterionRollback trigger
Task qualityNo material regression for priority cohorts; critical invariants always passCritical tool, schema, or safety failure exceeds threshold
ReliabilityCompletion and error rates meet the current SLO under expected loadTimeout, rate-limit, or partial-stream rate breaches gate
PerformanceTime to first token and total latency stay within cohort budgetsTail latency harms the user-facing objective
EconomicsAccepted cost per successful task improves after retries and reviewCost per accepted outcome exceeds agreed ceiling

Why a base URL swap is not enough

A compatible target may accept the same JSON while differing in model behavior, default parameters, tool calling, structured output, stream events, errors, usage accounting, latency, pricing, policy and data handling. The application can remain syntactically healthy while outcomes regress.

Treat migration as a sequence of reversible gates: inventory, compatibility matrix, golden tests, dual run, diff, canary and rollback-ready cutover. Each gate has workload-specific acceptance criteria and named owners.

Inventory every dependency the provider owns

Search code, configuration, secret stores, CI, dashboards, runbooks, notebooks, evaluation jobs, and support documentation. Interview the teams that operate the workloads; static search rarely finds manual console settings, provider-side prompts, fine-tunes, batch jobs, allowlists, account limits, or invoice allocation rules.

Application contract

SDKs, endpoint paths, authentication, model names, request fields, streaming parser, errors, retries, response objects, and provider-specific extensions.

Workload behavior

System prompts, templates, tools, JSON schemas, stop conditions, context assembly, conversation state, RAG, multimodal inputs, and output post-processing.

Operations

Rate limits, quotas, keys, regions, dashboards, alerts, status pages, support escalation, logs, traces, budget controls, and incident procedures.

Data and commercial terms

Retention, training use, subprocessors, data regions, deletion, export, pricing dimensions, discounts, commitments, credits, and termination obligations.

Migration gates and exit criteria

GateBest fitVerify before choosing
InventoryComplete map of applications, workloads and operational dependencies.No unknown production caller, key, extension, tool, data policy or billing owner.
Compatibility matrixField-by-field and behavior-by-behavior comparison.Every required gap has a mitigation, typed extension or explicit block.
Golden testsDeterministic workload suites and accepted invariants.Target passes required tools, schemas, streams, errors, safety and output checks.
Dual run and diffCurrent and target execute the same representative traffic.Structural, semantic, usage, latency and cost deltas fit the acceptance envelope.
Canary and cutoverSmall risk-bounded traffic moves with live gates.Quality and SLOs remain stable; rollback switch, evidence and owners are ready.

Compare behavior, not only schemas

Feature semantics

Tools, strict output, reasoning, context, modalities, streaming and stop behavior.

Failure semantics

Timeouts, status codes, error bodies, rate-limit hints, retryability and partial streams.

Operational economics

Native usage units, price dimensions, latency distribution, retries and review cost.

Trust and lifecycle

Data terms, region, retention, safety, versioning, deprecation and support.

Build an evaluation suite from production decisions

A random prompt benchmark cannot prove migration safety. Sample real workload cohorts: short and long inputs, difficult languages, tool-heavy requests, strict schemas, safety-sensitive cases, high-value customers, large contexts, and known failure examples. Remove or approve sensitive data before replay.

Define deterministic invariants separately from subjective quality. JSON must parse, required fields must exist, tool arguments must validate, prohibited actions must not occur, citations must resolve, and side effects must remain disabled. For open-ended quality, use calibrated human review or a validated judge with blind ordering, cohort-level thresholds, and disagreement analysis.

Dual-run safely and compare accepted outcomes

Dual running sends the same approved logical request to the current and target paths. Only one path may own user-visible output or side effects. Tool execution, email, payments, database writes, and external actions must be disabled or idempotent on the shadow path.

Compare normalized evidence and native evidence. Normalized fields make providers comparable—task, status, latency, cost, accepted result—while native fields preserve model identifiers, finish reasons, token categories, safety signals, tool details, and request IDs needed to explain differences.

Canary by risk, not only percentage

One percent of global traffic can still include the most sensitive customer or largest tool action. Start with internal users, reversible workloads, non-regulated data, and customers who agreed to participate. Expand by workload, tenant, region, language, feature, or traffic slice only after live gates remain healthy.

Automatic stop gates should cover critical invariant failures, error and timeout rates, partial streams, tool validation, user correction, support tickets, cost per accepted task, and safety outcomes. A stop gate freezes expansion and routes new traffic back; it should not destroy evidence or immediately decommission the target.

Compare cost per accepted task, not token price

A cheaper model can require longer prompts, more retries, extra validation, more human review, or a second pass. A faster model can reduce infrastructure and user abandonment even when token price is higher. Reconcile provider invoices with gateway or application telemetry before claiming savings.

Economic formula: accepted-task cost = provider charges + retries + gateway or platform fees + evaluation and review + additional infrastructure + failure remediation.

Close data, contract, and lifecycle obligations

Technical cutover does not finish the migration. Export historical usage, invoices, evaluation records, fine-tune artifacts, batch results, prompts, and configuration that must remain available. Confirm which data the previous provider retains, how deletion is requested and evidenced, when credits expire, how commitments terminate, and whether support access remains during the stability window.

Create a model lifecycle record for the new path: provider, account, region, model and version policy, aliases, owners, release date, evaluation bundle, approval, data classification, pricing version, support contact, deprecation source, and replacement plan. A migration that removes one undocumented dependency but creates another has not reduced lock-in.

Keep the old route isolated but usable until final acceptance. “Hot” does not mean it must receive normal traffic; it means credentials, capacity, configuration, network access, monitoring, and staff knowledge remain sufficient to restore service within the rollback objective. Test that state rather than assuming it.

LLM provider cutover checklist

Before dual run

Scope, owners, baseline, compatibility matrix, test cohorts, data approval, target quotas, support contacts, dashboards, and rollback route are ready.

Before canary

Critical invariants pass, side effects are isolated, telemetry reconciles, stop gates are automated, on-call has access, and old capacity remains available.

Before full cutover

Quality, reliability, latency, cost, security, and data handling meet cohort thresholds across the agreed canary window.

Before decommission

Rollback drill passes, invoices reconcile, historical data is exported, retention and deletion obligations are fulfilled, and contracts can close safely.

Run a reversible migration

  • Freeze the current production baseline and collect representative workload samples.
  • Contract-test the target and block unsupported required capabilities before execution.
  • Dual-run with redacted or approved data and store comparable evidence.
  • Canary by workload risk, tenant or traffic slice with automatic stop gates.
  • Keep the previous route hot until the stability window and rollback drill pass.

Put a migration switch above both providers

Applications call a stable workload interface. A versioned route policy sends approved traffic to current, target or dual-run paths. Provider adapters preserve explicit differences. A diff pipeline compares normalized and native evidence. Canary gates change policy gradually; the rollback switch restores the prior route without an application redeploy.

Production rule: do not decommission the prior path until rollback has been exercised under production-like load.

Common LLM provider migration mistakes

Testing only happy-path chat

The migration ignores tools, strict schemas, long context, streaming interruption, multimodal inputs, rate limits, safety cases, and malformed responses.

Changing provider and prompt together

When output changes, nobody can tell whether the model, prompt, routing, temperature, or retry policy caused it.

Shadow traffic with side effects

The target path sends duplicate messages, writes data, calls tools, or creates charges because “shadow” execution was not isolated.

Comparing average quality only

Averages hide failures for important languages, tenants, rare tools, safety cohorts, or high-value workflows.

Canceling the old account early

Credentials, quotas, data export, support access, or capacity disappear before the new path survives a rollback drill.

Assuming OpenAI compatibility means parity

Matching request fields hides differences in supported endpoints, tools, streaming events, errors, token accounting, and provider-specific capabilities.

Keep capability integrations stable during model migration

QVeris sits above the model gateway as the complementary interface for external APIs, tools, services and live data. Keep those capability contracts and trace fields stable while the inference provider changes. This isolates model migration from the real-world integrations an agent depends on.

Switch configuration only after contract evidence passes

Treat a provider switch as a release with an artifact: exact model, endpoint, adapter version, test results, rollout cohort, and rollback target. This separates a reversible route change from an application deployment.

Promotion record
  • Change one dimension at a time: route, model, prompt, or retry policy.
  • Use shadow traffic only when data terms permit it and outputs cannot cause side effects.
  • Promote gradually and retain evidence for both success and rollback decisions.

Verified implementation reference: OpenTelemetry GenAI conventions.

Can migration be only a base URL change?

Only for very simple workloads after tests prove the target preserves every required behavior.

What should be dual-run?

Representative production workloads, especially tools, strict schemas, streams and failure paths.

When can the old provider be removed?

After the stability window, reconciliation, incident review and a successful rollback drill.

More LLM provider migration questions

What is a dual run?

The same approved logical workload runs on both providers, while only one path may produce user-visible output or side effects. Structural, semantic, performance, usage, and cost evidence is compared.

How should migration be rolled out?

Use risk-bounded canaries by workload, tenant, region, language, feature, or traffic slice. Define automatic stop gates and expand only while quality and service objectives remain stable.

How can we reduce provider lock-in?

Use a product-owned workload interface, explicit adapters, stable task aliases, portable prompts and schemas, conformance tests, native telemetry, and a tested routing switch.

Official sources and further reading

Provider APIs and model behavior evolve. Verify the current primary documentation for every endpoint, model, region, quota, safety setting, data term, and deprecation involved in the migration.