What moving LiteLLM models to the database involves
Moving LiteLLM models from config.yaml to the database is a configuration and operations change, and the decision at its center is the salt key. Effort depends on how many models, provider keys and guardrails exist today and on how config is currently reviewed, since a team that gates every change through Git will need a new approval path once changes happen in the Admin UI or API. Setting store_model_in_db to true moves runtime configuration such as models, credentials and guardrails into PostgreSQL, so the database becomes the source that every gateway pod reads.
Each pod picks up those changes by polling the database in a background job, so a change converges across pods within the polling interval. The interval defaults to 30 seconds and is tunable, according to LiteLLM's production best practices, so confirm the value you intend to run before telling users that a new model or revoked credential is live. Provider credentials stored in the database are encrypted with LITELLM_SALT_KEY, and that key cannot be rotated once models have been added, because changing it makes the stored credentials unreadable. Generate the key before the first model is saved, store it in your secret manager, and back it up with the database restore procedure.
Plan for a parallel path for config as code. Decide which settings stay in config.yaml (typically the deployment-level settings and the salt key reference) and which move to the database, and document who may change database-managed models and how those changes are recorded. Test the full sequence in a non-production environment with a restore: confirm that a restored database still decrypts credentials under the same salt key, and that a pod started from a clean image reads the stored models. Ask LiteLLM's documentation and your own environment to confirm any behavior the team relies on.
Which config.yaml settings map to database-managed models
This table compares each major config.yaml section with how it is handled once store_model_in_db is enabled and models are managed in the Admin UI or API. Read the last column first: it shows what must be re-entered or verified after the switch. Confirm every mapping against the LiteLLM documentation for your release before you cut over, because parity is not documented for every setting.
| Config section | Stays in config.yaml | Managed in the database after switch | Action after switch |
|---|---|---|---|
| model_list entries | Startup-only definitions you choose to keep as a baseline | Models added through the Admin UI or API, polled by each pod | Recreate each model in the database and confirm routing matches the file |
| Provider credentials | Not recommended to keep in plain text in the file | Stored encrypted using LITELLM_SALT_KEY | Re-create every credential under the salt key; stored values are not portable |
| general_settings | Database URL reference and bootstrap values | Some runtime settings may be editable in the UI or API | Check each key against the release docs; do not assume full parity |
| Guardrails | Guardrail definitions in config as code, if kept | Guardrails can be managed from the Admin UI or API | Re-create guardrails and test that each still applies to the intended keys and models |
| router_settings | Routing strategy and retry values, if defined in file | Confirm whether router settings are read from the database or only from the file | Verify routing strategy, cooldowns and fallbacks with a test request after cutover |
| Master key | LITELLM_MASTER_KEY kept in a secret manager, not in the file | Used for admin API access in both modes | Confirm admin access works and that the key format still matches the release requirements |
| Salt key | LITELLM_SALT_KEY set as an environment secret before first model is stored | Encrypts stored provider credentials | Store it safely: changing it after models are added makes stored credentials unreadable |
| Polling and reload | Not applicable | Each pod polls the database on a background job; default interval is 30 seconds | Confirm all pods converge after a change and tune the interval if needed |
How pods pick up changes by polling the database
With store_model_in_db set to true, each LiteLLM pod runs a background job that reads models, credentials and guardrails from the database. A change made through the Admin UI or API is not pushed to pods. Instead, every pod picks it up on its next poll, so the change converges within the polling interval. The documented default is 30 seconds, and the interval is tunable.
The interval is a trade-off between change speed and database load. A shorter interval makes new models and key changes visible sooner, but every pod reads the database more often, and that load multiplies with replica count. A longer interval reduces reads but leaves pods serving the old configuration for longer after an edit.
- Replica count: Each pod polls independently, so total read load grows with the number of replicas.
- Change urgency: Routine model additions can tolerate a longer interval, while emergency removals of a provider need a shorter one.
- Database headroom: Confirm the polling load against your PostgreSQL connection limits and any pooler such as PgBouncer.
- Tuning location: Confirm in the LiteLLM production documentation which setting controls the interval in your version.
- Staging test: Measure convergence time in a staging environment with the same replica count before choosing a value.
Before production, record the convergence time you observe for a model add and a model removal in staging.
Because configuration is stored in the database, anyone with permission to change it can alter live routing and credentials without a deployment. The change does not wait for a rollout, so a bad edit reaches every pod within roughly one polling cycle. Security reviewers should treat the Admin UI and API as production change paths, not as a convenience tool.
Review who holds admin roles, how those roles are granted, and whether changes are logged. Stored provider credentials are encrypted with the salt key, so the review should also cover where that key lives and who can read it.
- Live routes: A change that points a model alias at a different provider or endpoint takes effect across all pods after polling.
- Credential changes: Replacing a provider key is effective fleet-wide without a restart, which shortens the window for misuse but also for mistakes.
- Blast radius: A single misconfigured guardrail or route can affect every team sharing the gateway at once.
- Access control: Confirm which roles can edit models and credentials, and whether Enterprise audit logs are needed to record those edits.
- Rollback path: Confirm how a bad change is reverted and how quickly that revert converges across pods.
Ask the platform team to demonstrate a change, its propagation to all replicas and its rollback in staging before approving production access.
After a change in the database, operators need evidence that every replica has loaded it, not just that the Admin UI saved it. Because pods poll independently, a replica can briefly serve the previous configuration. Verification should cover the database state, each pod's loaded state and live requests through the gateway.
Start by recording the time of the change and the expected interval. Then check each replica directly, using the health and logging endpoints your version exposes, and compare what each reports against the change you made. Confirm the check method in the LiteLLM documentation for your release, since endpoint behavior can vary.
- Time anchor: Record the change time so you know when the polling window closes.
- Per-pod check: Query each replica, not only the service, because a load balancer can hide a stale pod.
- Request test: Send a test request to the changed model alias and confirm the provider and route used.
- Log review: Check gateway logs for errors from the changed model or credential after the window passes.
- Repeat after scaling: Verify again when replicas are added, since new pods must complete their first load.
Record the verification steps as a runbook, and rehearse them in staging before relying on them in production.
How config changes flow from the Admin UI to every pod
An administrator changes a model, credential or guardrail in the Admin UI or through the API, and the change is written to PostgreSQL. Each LiteLLM pod runs a background job that polls the database, then applies the new settings to its in-memory router, so pods converge within the polling interval, which defaults to 30 seconds. Check that every pod reads the same database, that stored credentials are protected by the salt key held outside the database, and that deployment settings still live in Git as reviewed config.
Admin changes reach each pod by database polling, with the salt key guarding stored credentials.
Why the LITELLM_SALT_KEY decision comes first
Once store_model_in_db is enabled, provider credentials live in the database, encrypted with LITELLM_SALT_KEY. The cards below cover what that key does, why its handling must be settled before the first model is saved, and what to confirm before you rely on the database as the source of truth.
What the salt key protects
LITELLM_SALT_KEY encrypts the provider credentials that LiteLLM stores in the database when models are managed from the Admin UI or API. Those credentials are the API keys and secrets your gateway uses to call upstream providers. The key is a deployment-level secret that every pod needs in order to read them, so it is part of the gateway's runtime configuration, not an optional setting.
Production deployment docsNo rotation after models are added
The salt key cannot be changed once models with stored credentials exist. Changing it makes those credentials unreadable, so the gateway would fail to call the providers they belong to. Plan on the key being fixed for the life of the database contents. Ask your deployment team to confirm, in writing, how the vendor documents any change to this key at that stage before anyone treats it as rotatable.
Generate, store and back up first
Generate the key with enough entropy for a long-lived secret, store it in your organization's secret manager, and record who can read it under which access policy. Make a backup of the key before the first model is saved, stored separately from the database backup. Confirm that every pod, and any restored environment, receives the same value from the secret manager.
Database backups and restores
A database backup contains the encrypted credentials but not the key that decrypts them. A restore into a new environment therefore works only if the same salt key is available there. Test a restore in a non-production environment that uses only the backed-up key and database, and confirm that models and their credentials resolve before you treat the backup as usable.
Recovery if the key is lost
If the key is lost or no longer matches, stored credentials cannot be decrypted, and recreating them means re-entering each provider secret from its source. Before go-live, ask the vendor what recovery options exist, whether any supported path exists to re-encrypt stored credentials, and what your deployment should keep outside the database so that recreation is quick and accurate.
How to plan the switch with a parallel run and cutover
This sequence moves model, credential and guardrail management from the config file to the database while keeping the file reviewed and usable until the database path has been proven across every replica.
Inventory every model, credential and guardrail
The platform team lists every model entry, provider credential, fallback and guardrail defined in config.yaml, noting which route each one serves and which teams call it through virtual keys. Each item is recorded with its owner and its current source of truth. The step is done when the inventory matches the running config and a reviewer has signed off on it.
Set up PostgreSQL and a stored salt key in staging
The team provisions a PostgreSQL database for the staging gateway and generates the LITELLM_SALT_KEY, which is stored in the organization's secret manager alongside LITELLM_MASTER_KEY. Because the salt key cannot be rotated once models are stored, the team records where it lives and who can recover it. The step is done when the staging gateway starts against the database and the salt key is confirmed to be retrievable from the secret store.
Enable store_model_in_db and load models
In staging, the team sets store_model_in_db to true and either imports the inventoried models or re-enters them through the Admin UI or API, testing one provider credential at a time. Credentials are entered through the secret path, not pasted into shared tickets. The step is done when every staging model appears in the database-backed list and a test request succeeds through each route.
Verify polling convergence across replicas
With two or more pods running in staging, the team changes one model or guardrail in the Admin UI and confirms that every pod serves the change within the polling interval, which defaults to 30 seconds and can be tuned. They also test a deletion and a credential update, since those are the changes most likely to leave a stale pod. The step is done when every replica returns the same model list and responses after the change.
Run config as code and database state side by side
For a defined parallel period, the file-based config stays in version control and is still deployed, while day-to-day changes are made in the database. A scheduled comparison exports the database state and diffs it against the reviewed file, so drift is found early. Any change made in either place is copied to the other and reviewed. The step is done when the diff has been clean for the agreed review cycles and the owners accept it.
Cut over and retire the file-based path
The team makes the database the single source of truth for runtime models, credentials and guardrails in production, repeating the convergence test on production replicas before routing live traffic. The config file is kept in version control as a reviewed record, but it no longer drives runtime changes. The step is done when production traffic is served from database-managed models and the change log shows the cutover.
Keep the reviewed file as the audit source
After cutover, the team keeps the last reviewed config.yaml, the inventory and the convergence test results in the change repository, and documents how database changes are exported and reviewed. The file-based deployment path is removed from the pipeline so that no stale file can overwrite stored models. The step is done when the pipeline no longer deploys the old file and the retained record is reachable by the security and compliance reviewers.
Keeping config as code alongside database-managed models
Decide up front which settings stay in Git and which are managed live, because a split that is not written down becomes drift within a few weeks. A workable default is to keep deployment settings in Git: the image tag, replica count, store_model_in_db, general_settings such as the database and Redis connection references, and the master_key and LITELLM_SALT_KEY references. Models, provider credentials and guardrails move to the Admin UI or API, since that is where the store_model_in_db setting makes them authoritative. Write this boundary as a short ownership document in the same repository so reviewers can tell at a glance where a change belongs.
Treat live changes as reviewed changes even though they bypass a merge request. Put model and guardrail edits behind a named approver, record the change ticket in the change description, and restrict the admin role that can write to the database to the people on that approval path. Because each pod polls the database on its background job, a bad change reaches every replica within the polling interval, which defaults to 30 seconds. Confirm with your own tests whether you want to tune that interval, and plan a rollback step that re-applies the last known good model entry. Schedule a periodic export of database state (models, keys, teams and budgets, with credentials excluded) to an audit store so you can show what was live on a given date.
Keep LITELLM_SALT_KEY and master_key out of Git and out of the database. Reference them from your secret manager and inject them into the pod at runtime, with access limited to the workload identity that needs them. The salt key is the sensitive one: it encrypts provider credentials already stored in the database, and the production guidance says it cannot be rotated after models are added, because changing it makes those credentials unreadable. Before go-live, confirm with your security team how the key is generated, backed up in a separate escrow location, and recovered after a database restore. Decide whether a restored database is ever started with a different salt key, and make that a documented, rejected-by-default action.
Documented paths for importing and exporting model configuration
Once store_model_in_db is enabled, model definitions can live in three places: the config.yaml file, the Admin UI and API, and the configuration files kept in Git. Each path has a different owner and a different failure mode, so decide which one is the source of truth before you migrate.
config.yaml with store_model_in_db
The starting point is the existing config.yaml, with store_model_in_db set to true so the proxy writes model entries into PostgreSQL. Confirm in your LiteLLM release how existing model_list entries are written to the database on first start, including whether they are copied, skipped or duplicated on later restarts. Check that each entry lands once, with its credential reference intact, before you remove anything from the file.
- Default polling interval
- 30 seconds
Admin UI for model changes
After the switch, platform staff can add, edit and remove models from the Admin UI without a config file change or pod restart. This suits quick provider changes and model onboarding, but changes made here are not written back to config.yaml. Record who may use the UI, and keep a log of changes outside the proxy so reviewers can reconstruct what changed and when.
Admin API for scripted changes
The proxy's management API lets a pipeline create, update or delete model entries. Use it when model changes must follow a change ticket or an approval step. Confirm the exact endpoints, request fields and authentication for your release, and test them against a non-production database first, since a script that edits live credentials can break every route that uses them.
Configuration files kept in Git
Keep a reviewed copy of the model configuration in a Git repository, so every change has an author, a diff and a rollback point. Decide whether Git or the database is the source of truth. If both change, the repository and the live database will drift, and the next deployment may overwrite or ignore recent edits. Document that decision in the repository's README.
Export and drift checks
This page does not describe a separate export tool, so plan a periodic comparison between the database contents and the Git copy instead. Ask your LiteLLM release notes or support channel whether the model list can be read back through the API in a documented form. Until that is confirmed, treat the Git file as the reviewed record and the database as runtime state.
Salt key and credential handling
Stored provider credentials are encrypted with LITELLM_SALT_KEY, and that key cannot be rotated once models exist in the database, because changing it makes stored credentials unreadable. Keep the salt key in a secret manager, back it up with the database, and confirm the handling for existing config.yaml credentials before you export or recreate any entry.
What drives the effort and cost of the switch
This table lists the factors that raise or lower the work of moving LiteLLM models, credentials and guardrails from config.yaml into the database. Read each row against your own estimate of model count, pod count and change review rules, then ask for the one-time and recurring components separately in any quote.
| Driver | What raises the work | What lowers the work |
|---|---|---|
| Models and provider credentials | Many models, several providers, and credentials that must be re-entered and checked one by one during import | A short, well-inventoried list of models with credentials already held in a secret manager |
| Guardrails and team-level settings | Guardrails bound to many teams or keys, each needing its own review and test after the move | A small set of global guardrails that apply the same way to every team |
| Salt key custody | No existing secret manager, so the LITELLM_SALT_KEY value must be created, stored and backed up by hand before any model is added | An existing secret manager already holding the salt key with a documented owner and recovery path |
| PostgreSQL and Redis readiness | A single database or Redis instance with no tested failover, which becomes a shared dependency for every pod's polling | Highly available PostgreSQL and Redis already run and are monitored, so polling failures are visible early |
| Pod count and polling behavior | Many pods, each polling the database on its own schedule, so change propagation and load need checking at scale | A small, fixed pod count with a polling interval that the team has measured and documented |
| Change review rigor | Regulated approval steps for every model or key change, plus audit evidence for each edit made in the Admin UI or API | Lightweight review limited to a named owner and a logged change record |
| Parallel run requirement | Keeping config.yaml and database state running side by side while callers are cut over in stages | A short maintenance window with one authoritative source of models from the start |
| Recurring: config as code and reconciliation | Keeping a version-controlled config file in step with database changes, which needs a process and an owner | Export or sync tooling already in place, with drift checks scheduled |
| Recurring: database and key operations | Ongoing PostgreSQL maintenance, backups, salt key custody and access reviews for the credentials stored in the database | Existing database operations and key rotation runbooks that cover the LiteLLM schema |
What usually goes wrong when models move to the database
Moving models, credentials and guardrails into the database shifts change control from files and pull requests to live edits that every pod picks up. The risks below connect through one property: a single mistake in the database can reach every running pod within the polling interval, and the salt key and backups determine whether stored credentials can ever be recovered.
Salt key lost or changed
Credentials stored in the database become unreadable if the salt key changes. LITELLM_SALT_KEY encrypts provider credentials, and it cannot be rotated once models are added. Prevention is to store the key in a secret manager with a recorded owner and a documented restore procedure before the first model is saved. Test by confirming a fresh pod started with the stored key reads existing models and that a missing or wrong key fails in a visible way.
Production deployment docsBad live change reaches every pod
A model edit or guardrail change saved in the Admin UI or API is not staged, so every pod that polls the database applies it. The convergence window is the polling interval, which defaults to 30 seconds. Prevention is to limit who holds write access to model and guardrail tables and to keep a rollback record of the previous values. Test by changing a non-production model alias, timing how long each pod takes to show the new route, and reverting it.
Production best practicesDrift between Git and the database
The database becomes the source of truth, while the config file in Git still describes an older set of models. The next redeploy or a second environment built from Git then behaves differently from production. Prevention is to choose one owner for each model entry and export database state on a schedule for review. Test by comparing the exported model list with the repository after a change made only in the Admin UI.
Stale pods that have not converged
A pod that cannot reach the database, or whose background job has stalled, keeps serving the routes it loaded earlier. Callers then see different models depending on which pod answers. Prevention is to alert on pods whose loaded configuration does not match the database and to include the polling job in health checks. Test by blocking one pod's database connection during a change and confirming the alert fires and the pod is removed from rotation.
Unreviewed Admin UI edits
Anyone with admin access can change routing, add a provider or remove a guardrail from the interface without a second reviewer. Those edits affect production traffic immediately and leave no diff for an auditor to read. Prevention is to restrict Admin UI roles to named operators, enable audit logging on configuration changes, and require a ticket reference for each change. Test by making a routing change under a limited role and confirming the audit record shows who changed what and when.
Backups that restore without matching keys
A database restore brings back encrypted credentials, but the salt key in the restored environment may be missing, different or from another cluster. The gateway then starts with models it cannot use. Prevention is to back up the salt key separately under its own access control and record which key version matches each backup. Test by restoring the database into an isolated environment with the matching key and confirming that every provider model answers a test request.
Continuous archiving docsQuestions teams ask before moving LiteLLM models to the database
How much effort does moving LiteLLM models from config.yaml to the database take?
The effort depends mostly on how many models, credentials and guardrails you run today and how much of your change process depends on the file. The switch itself is a configuration change: you set store_model_in_db to true, move model entries into the database through the Admin UI or API, and check that each route still resolves. The larger share of work is usually inventory and planning: listing every model alias, provider credential and guardrail, deciding who may edit them, and deciding how the config file will be kept as code. Ask any partner to base the quote on your written inventory and change-approval rules.
Can our own team move models to the database without outside help?
Yes, if your engineers can work with a PostgreSQL database, a secret manager and your gateway deployment pipeline. The LiteLLM documentation covers the store_model_in_db setting and the salt key, and the work is mostly careful sequencing. Outside help tends to be useful where the gateway serves many teams, where credentials must move into a secret manager without downtime, or where audit evidence for the change is needed. Decide this by checking whether someone on your team has already run the gateway in production and owns its database.
How long does it take for pods to pick up database changes, and how do we change the interval?
Each LiteLLM pod polls the database on a background job, so a change converges within the polling interval. The documented default is 30 seconds, and the interval is tunable. Check the production best practices page for the exact setting name in your release before you change it, and test the value in a staging environment. A shorter interval increases database read load across all pods, while a longer one delays changes reaching every replica. Plan change windows around the slowest pod, not the one you test first.
Can we rotate the LITELLM_SALT_KEY after models are stored?
No. The documented behavior is that LITELLM_SALT_KEY encrypts provider credentials stored in the database and cannot be rotated once models are added, because changing it makes those credentials unreadable. Set the salt key before you store the first model, keep a secure backup in your secret manager, and record which environment it belongs to. If you later need a different key, plan a re-entry of every stored credential as a controlled change, and confirm the current procedure with your LiteLLM vendor before you attempt it.
Can we keep config.yaml as the source of truth while using the database?
Yes, but you need to decide which source owns each setting. Many teams keep stable infrastructure settings, such as the database URL, general settings and the master key reference, in config.yaml under version control, and manage models, credentials and guardrails in the database through the Admin UI or API. The risk is drift: a model edited in the UI that no longer matches the Git file. Write down the ownership split, add a review step for any UI change that is later exported to Git, and check which keys each file is allowed to hold.
What does the work need from our team: database access, secret manager and change approvals?
Three inputs drive most of the planning. First, the gateway needs a PostgreSQL database that it can read and write, and your database team must agree on backups, connection limits and who can query the model tables directly. Second, provider credentials and the salt key should sit in a secret manager, and someone must own rotation of the upstream keys. Third, editing models in the database bypasses the review you may already have for config.yaml changes, so define who approves a model or credential change and how that approval is recorded.
How do we verify that the migration worked?
Verify in three layers. First, confirm that every model alias from the old file resolves in the database and returns the same provider and route in a test request. Second, send a test request through each pod, not only through the load balancer, and check that the configuration converges after an edit within the polling interval. Third, confirm the salt key decrypts stored credentials after a pod restart, and keep the before-and-after inventory as change evidence. Your own change record and the LiteLLM logs are the evidence auditors will ask for, so store them with the change ticket.
How DeployOpen scopes and delivers the switch
DeployOpen treats the move from config.yaml to the database as a controlled change to a live gateway. We start by inventorying what the file currently holds, then move models, credentials and guardrails in stages while keeping the salt key, the master key and the config-as-code path under your control.
How we scope
- Inventory every model, credential and guardrail in your current config.yaml and map each one to its owner and team
- Confirm the PostgreSQL database and Redis setup that the store_model_in_db switch depends on in your environment
- Agree in writing how LITELLM_SALT_KEY will be generated, stored and backed up before any credential is written to the database
How we build
- Set store_model_in_db in a staging deployment and confirm that each pod converges on database changes within the polling interval
- Tune the reload interval against your change process, then document the value so operators know how long a change takes to appear
- Keep the config file as version-controlled code for the parts that stay in it, and test that a rebuilt environment restores the same models
How we hand over
- Deliver a runbook covering adding, changing and removing models from the Admin UI and API with the review steps you choose
- Document the salt key rules, including that the key cannot be rotated after models are stored, and where the recovery copy is held
- Provide a written record of the final split between database-managed and file-managed settings, with a rollback path
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the switch
- Retest model routing, credential handling and guardrail behavior after each LiteLLM upgrade that touches configuration loading
- Review the database backup and restore procedure for the gateway's store, so stored credentials can be recovered with the salt key

