LiteLLM master key and salt key management

Separate the LiteLLM admin credential from the key that encrypts stored provider credentials, rotate it without re-registering models, and protect the salt key from changes.

On this page

Why LiteLLM master key and salt key management decides whether rotation is routine

A platform team that runs a shared LiteLLM gateway holds provider credentials for every model it routes to, and it will eventually need to rotate secrets on a schedule. Whether that rotation is a routine change or a risky migration depends on two settings that look similar but do different jobs. The LITELLM_MASTER_KEY is the admin credential that authenticates administrative API calls. The LITELLM_SALT_KEY is the encryption key that protects stored provider credentials at rest. Teams need this page when they are standing up a gateway, when they plan a rotation policy, or when they are about to add the first model and have not yet decided where the salt key lives.

The practical question is whether the two keys are separate. When LITELLM_SALT_KEY is set, the master key is only an admin credential, so rotating it means setting a new value and restarting every proxy instance. Without a salt key, the master key also encrypts stored data, and rotation becomes a data re-encryption exercise through POST /key/regenerate or the LITELLM_MIGRATE_FROM_MASTER_KEY boot flow. Before choosing a rotation path, confirm with your own environment whether a salt key was set when the gateway was first deployed, because the answer is hard to change later.

Virtual keys sit outside this encryption work. LiteLLM stores virtual keys hashed rather than encrypted, so they keep working through either rotation flow, and callers do not need new keys when the master key changes. LiteLLM still recommends a database backup before any rotation, and your change record should name who approves the window and how a failed restart is rolled back. Treat the salt key as permanent from the moment the first model is registered, and record where it is stored in your secret manager before that first model is added.

Key configuration options and when each fits

This table compares running LiteLLM with a separate salt key against running without one, then lists the two credential paths that matter during setup and rotation. Read each row against the state of your deployment: whether any models are already stored, and whether the master key is also the encryption key.

OptionWhat it protects or doesWhen it appliesTrade-off to plan for
With LITELLM_SALT_KEY setThe salt key encrypts and decrypts stored provider credentials. The master key is only an admin credential.Recommended for new deployments before any model is added.The salt key must never change after a model is added, so it needs its own secret store entry and backup.
Rotating the master key with a salt keyOnly the admin credential changes. Stored credentials are not re-encrypted.Any time the master key must be replaced.Needs a new value and a restart of every proxy instance. Confirm that all instances read the same secret.
Without a salt keyThe master key doubles as the at-rest encryption key for stored credentials.Deployments that already store models and never set a salt key.Changing the master key means re-encrypting stored data, so rotation is riskier and needs a database backup first.
Rotation through POST /key/regenerateRe-encrypts stored data using new_master_key.Running proxy without a salt key that must move to a new master key.Check the rotation guide for current behavior and take a database backup before calling it.
LITELLM_MIGRATE_FROM_MASTER_KEY at bootRe-encrypts stored data during startup using the previous master key.Only when moving an existing deployment without a salt key onto a salt key or a new master key.Confirm the exact sequence in the rotation guide. Keep the old key available until the migration is verified.
LITELLM_MASTER_KEY in a secret managerHolds the admin credential, which must start with sk-, outside config files and images.Every deployment, whichever key mode is used.Restrict read access to the proxy service accounts and log who can read or rotate the value.

Setting up the salt key and master key before adding models

This sequence produces a LiteLLM proxy with a dedicated admin master key, a salt key that encrypts stored provider credentials, and a verified starting state with a database backup taken before any model is registered.

  1. Generate the master key with the sk- prefix

    The platform owner generates a new LITELLM_MASTER_KEY value that begins with sk-, using a cryptographically random generator on a trusted workstation rather than a value typed by hand. The key is an admin credential only, so it should be unique to this deployment and never reused from another service. Confirm the value starts with sk- and that it is at least as long as the generator produced. The step is done when the value exists only in your generator output and is ready for storage.

  2. Store the master key in a secret manager

    The platform owner places the master key in the secret manager your organization already operates, such as a cloud secret service or HashiCorp Vault, and grants read access only to the workload identities that run the proxy. Do not place the value in a container image, a Helm values file committed to source control, or a shared chat channel. Confirm that a test workload can read the secret and that a user without the grant cannot. The step is done when the secret path is recorded in your deployment notes.

  3. Generate and store the salt key

    The platform owner creates a separate LITELLM_SALT_KEY value and stores it in the same secret manager under its own path, with access limited to the proxy workloads. Keep it distinct from the master key so that rotating the admin credential later does not touch the value that encrypts stored provider credentials. Record who holds an offline copy and where it is kept, because losing the salt key makes stored credentials unrecoverable. The step is done when the salt key is stored, separately named, and recorded in your key inventory.

  4. Set the salt key before the first proxy start

    The engineer sets LITELLM_SALT_KEY in the proxy environment alongside the master key and the PostgreSQL connection, then starts a single proxy instance. Setting the salt key before any model exists means every provider credential is encrypted with it from the first write. Check the startup logs for errors about the database connection and confirm the proxy reports healthy. The step is done when the proxy is running with both keys loaded from the secret manager and no plain-text values in configuration files.

  5. Back up the PostgreSQL database

    The database administrator takes a full backup of the PostgreSQL database that backs the proxy, before any model or credential is registered, and records the backup identifier and time. A backup at this point is cheap insurance because it gives a known restore point if a later configuration step goes wrong. Confirm the backup completes and that a restore test on a separate instance returns the proxy's tables. The step is done when the backup is stored outside the proxy host and its restore location is documented.

  6. Verify the proxy starts and lists models

    The engineer calls the proxy's health endpoint, then uses the master key to request the model list through the admin API, which should return an empty list at this stage. An empty list with a healthy status confirms that the database connection and both keys load correctly. Repeat the check after every proxy instance restart to catch secret mismatches early. The step is done when the health check passes, the model list call succeeds with the master key, and the results are saved with the deployment record.

  7. Freeze the salt key before registering models

    The platform owner records in the change log that LITELLM_SALT_KEY is now fixed for this deployment, and adds a control to the deployment pipeline that rejects changes to that variable. LiteLLM states that the salt key must not change after a model has been added, because there is no in-place migration and every stored credential would need to be re-registered. Only the master key should be rotated later. The step is done when the change is approved, the pipeline guard is in place, and the next model registration is scheduled as a separate change.

Security risks in how the salt key and master key are handled

The master key and salt key protect different things, and most mistakes come from treating them as one secret. The risks below cover how each key is stored, who can reach the admin credential, what happens when the salt key changes, and how backups carry encrypted credentials without the means to decrypt them.

Losing or changing the salt key

The salt key encrypts and decrypts every provider credential stored in the database. LiteLLM says it must not change once a model has been added, because there is no in-place migration and each stored credential would need to be re-registered. Check that the salt key value is recorded in your secret manager with an owner and a documented recovery path before the first model is added, and confirm the exact procedure with LiteLLM for your version.

Rotation docs

Master key stored in config files

Placing LITELLM_MASTER_KEY in a config file, a Helm values file or a container image exposes an admin credential to anyone with repository or image access. LiteLLM recommends keeping the master key, which must start with sk-, in a secret manager and injecting it at runtime. Check your repositories and build logs for the value, and confirm that the deployment pipeline reads it from the secret store rather than from source-controlled files.

Secret manager storage for both keys

Store the master key and the salt key in a secret manager your organization already audits, such as the cloud provider's secret service or a Vault-compatible store. Keep them as separate secrets with separate names so that one can be rotated without touching the other. Confirm which identities can read each secret, and confirm that the proxy's service account is the only runtime reader.

Production guide

Unrestricted admin access

Anyone holding the master key has full administrative rights, including creating keys, changing teams and regenerating the master key. Limit who can see the value to a small operations group, and issue day-to-day access through SSO-backed admin users and team roles instead of sharing the master key. Confirm which people can read the secret and which accounts currently use it to call admin endpoints.

Backups without key custody

A database backup holds stored provider credentials in encrypted form, so it is only useful for recovery if the salt key is also available. Keep backups and the salt key in separate custody, for example backups in one storage account and the salt key in a restricted secret store with its own access policy. Test restores on a non-production environment to confirm the salt key matches the backup.

Access logging for key reads

Reads of the master key and salt key in the secret manager should leave a trail that security staff can review. Enable access logging on the secret store, alert on reads from unexpected identities, and record each rotation with the date, the operator and the change ticket. Confirm which events your secret manager records and how long those logs are retained.

How the master key, salt key and database relate at runtime

The flow starts with an admin client calling the LiteLLM proxy with the master key, which authorizes admin API calls only. The proxy reads the salt key from the secret manager and uses it to encrypt and decrypt provider credentials stored in PostgreSQL. Virtual keys sit in the same database but are stored hashed, so they are not decrypted at all. Check that the salt key and master key come from separate secrets and that the secret manager and database stay inside the boundary you control.

Master key authorizes admin calls, while the salt key encrypts stored provider credentials.

Questions buyers ask about LiteLLM key management

What does LiteLLM master key and salt key work cost, and what drives it?

Cost comes from the hours your team or a partner spends on the key design, the rotation runbook, testing against a copy of the database and the change window itself. Most of the variation comes from how many proxy instances you run, how many models and provider credentials are already stored, and whether you have a tested database backup and restore path. Software licensing is a separate question: the open source edition covers these settings, but confirm with LiteLLM which features you need. Ask any partner for a fixed-scope quote that lists the environments, the number of proxy instances and the rotation steps included.

How long does a master key rotation or first salt key setup take?

Duration depends on the environment more than the key itself. A salt key set before any model is added is mostly configuration, a secret store entry and a rolling restart of every proxy instance. A master key rotation with a salt key in place needs only a new value and a restart of every instance, so the work is mainly coordination and verification. Rotation without a salt key takes longer because stored data is re-encrypted through POST /key/regenerate or at boot. Confirm the timing with your own staging run before committing to a production window.

What must our team provide before key management work starts?

The work needs access to the PostgreSQL database that the gateway uses, so a backup can be taken and verified before any change. It also needs write access to the secret manager that holds LITELLM_MASTER_KEY and LITELLM_SALT_KEY, and a way to restart or roll every proxy instance, such as your Kubernetes deployment pipeline. Provide a staging copy of the gateway, a named owner who can approve the change window, and the list of provider credentials already registered. Confirm with your platform team who holds each of these permissions.

Can our internal team handle LiteLLM key management alone?

Yes, if your team already runs PostgreSQL and a secret manager, and has time to test a rollback in staging before production. The steps are documented by LiteLLM in its rotation guide, and the critical decisions are a salt key that never changes after models are added, a database backup before rotation and a rolling restart of every instance. Teams without recent experience with the proxy often benefit from an outside review of the runbook and a second pair of hands during the change window. A partner engagement can be scoped to design, execution or review only.

What happens if the salt key is lost or changed after models are added?

A changed salt key is a serious incident because LiteLLM says there is no in-place migration. Stored provider credentials were encrypted with the old value, so the gateway cannot decrypt them and every stored credential would need to be registered again. Virtual keys are stored hashed rather than encrypted, so they keep working, but the models and provider connections depend on the salt. Prevent this by storing the salt key in a secret manager with backups, restricting who can edit it and recording its value in your disaster recovery plan. Confirm recovery steps with LiteLLM before you need them.

Do virtual keys stop working during master key rotation?

No. LiteLLM stores virtual keys hashed rather than encrypted, so they keep working after either rotation flow, whether the salt key is in place or the master key doubles as the encryption key. What changes is the admin credential and, in the flow without a salt key, the encryption of stored provider credentials. Still, take a database backup before any rotation and test a sample virtual key call after each proxy instance restarts. Ask your engineers to record the results in the change ticket.

Why must the master key start with sk- and where should it live?

LiteLLM's production guidance says LITELLM_MASTER_KEY must start with sk- and should be kept in a secret manager, not in a configuration file or source repository. The master key is an admin credential that can create and change keys, teams and models, so limit who can read it and log its use. Keep the salt key in the same managed store but with separate access rules, so that one leaked value does not expose both. Review the current practice against LiteLLM's production best practices page.

What a DeployOpen engagement covers for key management

A DeployOpen engagement for key management starts with key custody: who holds the LITELLM_MASTER_KEY, who holds LITELLM_SALT_KEY, where each value is stored, and who may read or change them. We record that decision in the scope before any configuration changes. The work then covers integrating both values with the secret manager your organization already runs, so the proxy reads them at startup and they never appear in container images, Helm values or shared configuration files. Confirm early which secret manager your security team has approved and whether your LiteLLM edition supports the integration you need, since secret manager integrations are listed among the Enterprise features in the LiteLLM Enterprise documentation.

The setup runbook is the main handover artifact. It records the value and ownership of each key, the startup configuration for every proxy instance, the database backup steps that must run before any rotation, and the order of operations for a rotation. We also write the checks that show the gateway is healthy after a change, such as confirming that stored provider credentials still resolve and that a test request reaches each configured model. A tested rotation procedure is run in a non-production copy of your environment first, so your operators see the exact commands, pauses and rollback points before they touch production. Ask for the runbook to name each person or role allowed to approve a rotation.

Written scope and deliverables are agreed before work starts. Engagements are fixed-scope, so the agreed document lists the environments covered, the rotation flows tested, the handover materials and the retest or review steps included. DeployOpen does not publish a price list, so a quote follows from that written scope. When you request one, ask which environments and secret managers are in scope, whether the rotation test is included, and whether handover includes training for your operators. Recurring items such as later rotations or upgrades are normally separate from the initial setup and should be stated as such in the quote.

How DeployOpen works on this

DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, including the LiteLLM proxy. For master key and salt key management, the work starts with a written scope that fixes which environments, secrets and rotation procedures are covered before any change is made to a running gateway.

How we scope

  • Inventory which LiteLLM environments exist and whether LITELLM_SALT_KEY is already set on each one.
  • Confirm whether any model has been added, since that determines whether the salt key can still be introduced safely.
  • Agree in writing where the master key and salt key are stored and which team holds each credential.
  • Define the rotation window, backup requirements and rollback criteria before any change is scheduled.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • Move the LiteLLM master key and salt key into your secret manager, keeping them out of configuration files.
  • Set up the salt key in the target environment so that stored provider credentials are encrypted under it from the start.
  • Run a tested master key rotation in a non-production environment, following LiteLLM's documented procedure.
  • Verify that virtual keys still authenticate after rotation and that provider calls succeed through every proxy instance.
  • Confirm that a database backup exists and can be restored before the production rotation begins.

How we hand over

  • Provide a runbook covering key storage locations, rotation steps, restart order and the rollback path.
  • Document which values must never change once models are registered, and the procedure to follow if one changes.
  • Record the configuration, secret paths and environment-specific settings in a form your team can review.
  • Walk your platform and security staff through the rotation procedure and the evidence it produces.

How we support

  • Support can be added as a retainer for upgrades, rotations and ongoing checks of key handling.
  • Retesting of key management controls can follow fixes or changes to the gateway configuration.
  • Ask for the support scope, response expectations and change process to be written into the quote.

Sources and further reading

Talk to our team.

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

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