Migrate from Dify Cloud to self-hosted Dify

A plan for moving apps, knowledge bases, credentials, MCP servers and API clients from Dify Cloud into a Dify deployment you run, using only the export paths the Dify docs describe.

On this page

Migrate from Dify Cloud to self-hosted Dify: what the move involves

A move from Dify Cloud to a self-hosted deployment carries over app configuration and very little else. Exported app DSL files include app configuration, workflow nodes, model parameters, prompts and knowledge base connections, but the app management docs state that exports exclude third-party API keys, knowledge base content and usage logs. Most of the effort therefore sits in rebuilding knowledge bases from source documents, re-entering provider and tool credentials, recreating MCP servers and API keys, and then cutting over every API client that calls the apps. The effort is driven by how much your team has built on Dify Cloud, not by the DSL export itself. Count the apps, the knowledge bases and their source documents, the model providers and tools that hold credentials, and the external clients that call published apps. Each knowledge base needs its files re-uploaded or re-synced and re-indexed in the new deployment, and each credential must be obtained again from the owning provider. Ask your own team to inventory these items before estimating, since no duration in this section is supplied for your environment.

Confirm the edition before you plan. The self-hosted Community edition is limited to a single workspace, according to the Dify pricing page. If your Cloud use spans several workspaces, a single Community instance will not hold that structure, and the Enterprise edition, which is custom priced, is the option to price. Also decide early how new API keys will be issued and how the cutover window will work, because every client must switch to the new endpoint and new keys. Keep the Cloud workspace running until the rebuilt apps and knowledge bases have been tested against real requests.

Which Dify Cloud assets map cleanly and which must be rebuilt

This table compares each Dify Cloud asset with its self-hosted equivalent and states how it moves. Read the migration note column as the work your team owns for that asset. The main takeaway is that DSL export covers app configuration and connections, while credentials, knowledge base content, MCP servers, API keys, usage logs and member roles need separate handling.

Cloud assetSelf-hosted equivalentMigration note
App configurationApp configuration in your workspaceCarries through DSL export and import; check settings that depend on your URLs and environment
Workflow nodesWorkflow nodes in the imported appCarries through DSL; re-test every branch because node dependencies on tools and models must resolve
Model parametersModel parameters in app settingsCarries through DSL; confirm that the same model names exist in your provider configuration
PromptsPrompts in the imported appCarries through DSL; review variables and template text after import
Knowledge base connectionsLinks from apps to knowledge basesConnection references carry through DSL, but the target knowledge base must exist in your deployment first
Knowledge base contentDocuments and indexes in your own knowledge baseNot in DSL; re-upload or re-sync from source documents and rebuild the index
Provider and tool credentialsCredentials entered in your deploymentNot in DSL; re-enter every third-party API key and tool credential under your own control
MCP serversMCP server entries in your deploymentNot in DSL; recreate each server entry and confirm endpoint reachability from your network
Service API keysNew API keys issued by your deploymentNot in DSL; issue new keys, then update every API client during cutover
Usage logsLogs in your own databaseNot in DSL; decide whether historical logs are kept in a separate archive or start fresh
Workspace members and rolesMembers and roles in your workspaceNot in DSL; map each Cloud member and role to your own identity model and confirm access in your environment

Documented export and import paths for Dify apps

Dify's documented path for moving apps is the YAML DSL export and import from the app management area, landing in a Docker Compose install. Knowledge bases, credentials, MCP servers and API keys are not part of that file, so each needs its own plan. No documented bulk tool that moves Cloud data wholesale is assumed here, and you should confirm current options with Dify before you plan.

App DSL export from Cloud

The DSL file is a YAML export of app configuration, workflow nodes, model parameters, prompts and knowledge base connections. Export each app from the app management area and store the files in version control with a record of which Cloud workspace and app version they came from. Check every exported workflow after import, because node references and model selections may need to be reset. The DSL file is a configuration copy, not a data copy.

What the DSL leaves behind

The docs state that exports exclude third-party API keys, knowledge base content and usage logs. Build an inventory before cutover that lists every provider credential, tool credential, MCP server, service API key and knowledge base each app depends on. Assign an owner to each item so none is discovered only after the Cloud workspace is closed.

Docker Compose import target

The target for imported apps is a self-hosted Docker Compose install that meets the documented minimum of 2 CPU cores, 4 GB of RAM and Docker Compose 2.24.0 or later. Confirm the install is at the same Dify version family as the Cloud features your apps use, since a feature missing on the target will fail on import. Keep the .env file and SECRET_KEY documented before the first import, because stored credentials depend on that key.

Knowledge base source archive

Knowledge base content does not travel in the DSL, so rebuilding requires the original source documents. Collect each knowledge base's files, URLs and sync sources from their owners, and record the chunking and index settings used in Cloud. Store the archive in your own object storage with checksums so that re-ingestion produces a traceable result.

Re-entering credentials and MCP servers

Provider keys, tool credentials and MCP server connections must be re-entered on the self-hosted instance by someone authorized to hold those secrets. Record which model endpoints and accounts each credential belongs to, and rotate keys that were shared through chat or tickets. Test each reconnected MCP server and tool with a sample call before any app is marked ready.

API client cutover

Service API keys are issued per app and do not move with the DSL, so each new key must be generated on the self-hosted app and handed to the client team. Plan a short overlap window in which both Cloud and self-hosted endpoints answer, then switch base URLs client by client. Confirm with Dify how any Cloud-issued keys are retired before you revoke access, and log which clients have switched.

How the parallel run and cutover sequence works

The sequence moves a Dify Cloud workload into a self-hosted deployment in controlled stages, so each app, knowledge base and API client is proven on the new platform before the old one is switched off. The output is a verified inventory, a validated target, and a cutover record that the client can audit.

  1. Inventory apps, models, tools and clients

    Start by listing every workspace asset that Dify Cloud holds: apps and their DSL exports, model provider configurations, custom and built-in tools, MCP servers, knowledge bases with their source document locations, and every service API key with the clients that call it. Export app DSL files, because the export carries app configuration, workflow nodes, model parameters, prompts and knowledge base connections, but not third-party API keys, knowledge base content or usage logs. Done when each asset has an owner, a target name and a row in a migration register that lists what must be re-entered by hand.

  2. Stand up the self-hosted target and a pilot app

    Deploy the self-hosted Dify target in the client's infrastructure, following the Docker Compose or Enterprise Kubernetes layout chosen in the design. Import one low-risk app from its DSL file, reconnect its model provider with a new credential, and confirm the workflow runs end to end. Record the SECRET_KEY, storage and vector store settings in the secrets register before any data is loaded. Done when the pilot app returns expected output and the deployment passes the backup and restore check the team has defined.

  3. Rebuild knowledge bases from source documents

    Do not copy knowledge base content from Cloud, because the DSL export excludes it. Recreate each knowledge base in the self-hosted target and upload the original source documents from their system of record, using the same chunking, index method and retrieval settings recorded during inventory. Re-indexing is where embedding and model costs appear, so confirm which embedding model and provider will be used before indexing starts. Done when every knowledge base reports its documents as indexed and the document counts match the source register.

  4. Validate retrieval against a shared test set

    Build a fixed set of test questions per knowledge base and per app, with expected sources or answers agreed by the business owner. Run the same questions against the rebuilt knowledge base and compare retrieved sources and answer quality with the Cloud results. Record deviations, such as missing chunks or different ranking, and fix the configuration before moving on. Done when each knowledge base has a signed-off test result that the owner accepts, and unresolved deviations are logged with a decision.

  5. Re-enter credentials and recreate MCP servers

    Re-enter every model provider key, tool credential and MCP server connection in the self-hosted target, using the client's own secret handling rather than values copied from notes. Test each connection with a low-cost call and confirm that outbound requests pass the proxy and allowlist policy set for the deployment. Recreate new service API keys for each client that will call the self-hosted apps. Done when every connection returns a successful test and the credential register records owner, scope and rotation date for each secret.

  6. Run Cloud and self-hosted side by side

    Send the same test set to Dify Cloud and the self-hosted apps for a parallel run, and compare outputs, latency, errors and logged behavior for each app. Keep Cloud as the production path while the comparison runs, and have business owners review disagreements and rule on whether the difference is acceptable. Done when the comparison record covers every app in scope, every open deviation has a recorded decision, and the owners approve moving to cutover.

  7. Cut over API clients by endpoint and key

    Switch API clients one at a time, changing the endpoint and the service API key together for each client. Start with clients that have the lowest impact and the easiest rollback, and confirm each client receives correct responses before the next one moves. Keep the old Cloud keys active until the cutover record shows every client is on the self-hosted target. Done when the client inventory shows every integration pointing to the self-hosted endpoint and the cutover log lists each change with its date and approver.

  8. Decommission Cloud resources after retention

    Once cutover is complete, keep Dify Cloud resources for the retention period the client sets, so that rollback and audit questions can still be answered. Then revoke Cloud API keys, remove unneeded provider credentials, delete workspace data where the client's policy requires it, and record each action. Confirm the retention period and the deletion approach with your own legal and records team before starting. Done when the decommission record shows each Cloud asset as revoked, deleted or retained with a stated reason.

What drives the effort and cost of moving from Dify Cloud

What is the biggest factor in the effort of moving Dify Cloud apps?

The number of apps and how complex their workflows are usually matters most. Each app needs its DSL exported, imported, and checked node by node, because exports carry workflow nodes, model parameters, prompts and knowledge base connections but not third-party API keys. A workflow with branches, code nodes, tool calls and sub-workflows takes longer to verify than a single-prompt chat app. Ask the partner to list apps by workflow complexity and to state which apps are in scope for the first cutover.

How does knowledge base volume change the cost of a Dify migration?

Knowledge base content is not included in a DSL export, so every knowledge base must be rebuilt from its source documents. The effort depends on how many documents still exist, how many are in formats that need cleanup, and how many datasets reference the same material. Where source files have been lost, the team must recover them from document owners or accept a gap. Ask for a count of datasets, documents and their original locations, and confirm whether re-indexing cost is included in the quote or billed separately.

Why do provider and tool credentials add time to a Dify move?

Third-party API keys are not carried in DSL exports, so each model provider, tool and external connection must be re-entered and tested in the self-hosted console. The work grows with the number of providers, the number of workspaces that hold them, and how many people hold the original keys. Credential rotation also needs a decision: reusing keys that were shared in the cloud account may conflict with your secrets policy. Confirm who can issue new keys and where they will be stored.

How many MCP servers and API clients affect cutover planning?

Every MCP server, service API key and calling client is a separate change. MCP servers must be recreated on the self-hosted instance, API keys must be issued again because they belong to the deployment, and each client needs its base URL and key updated. The effort rises with the number of products and pipelines that call Dify and with how many teams own them. Build an inventory of callers before the move, and plan a window where old and new endpoints can run side by side.

Does SSO or multiple workspace support change the scope?

Yes. The Community edition of self-hosted Dify is free and limited to a single workspace, according to the Dify pricing page. Multiple workspaces, SSO with identity providers such as Microsoft Entra ID, Okta or GitHub, and advanced security are listed for the self-hosted Enterprise edition, which is custom priced. If your Cloud usage spans several workspaces or needs corporate sign-in, the licensing decision and the SSO design become part of the scope, and the Enterprise deployment on Kubernetes adds infrastructure work.

How does target infrastructure readiness affect the cost of the move?

A fully prepared target lowers the effort, and a missing one raises it. The Docker Compose deployment requires at least 2 CPU cores, 4 GB of RAM and Docker Compose 2.24.0 or later, and it runs PostgreSQL, Redis, Weaviate, Nginx and other services. Production use often adds external storage, TLS, backups and monitoring, which the client's own platform team may already provide. Confirm which of these exist, who owns them, and whether the partner will build or only integrate them.

What does validation depth add to the cost, and what recurs afterward?

Validation depth sets how much testing is done before cutover: spot checks of a few apps, or full comparison of outputs, retrieval results and API responses for every app. Deeper validation takes more time but reduces the chance of silent quality drops. The migration itself is a one-time cost. Hosting, backups, security patches and the upgrades that Dify releases roughly monthly, according to the GitHub releases page, recur. Ask a quote to separate one-time migration work from ongoing support and to name the acceptance tests.

What usually goes wrong when moving apps out of Dify Cloud

Most failed moves from Dify Cloud are not technical breakdowns. They are assumptions about what an app export carries, what gets re-entered by hand, and what still points at the old endpoint. The cards below cover the failures we see most often and the check that prevents each one.

Assuming DSL restores knowledge bases

An app DSL export carries knowledge base connections, not the documents or their indexes. After import, the app may appear complete while its retrieval returns nothing. Before cutover, list every knowledge base each app references, then rebuild each one from its source documents in the new workspace and run a set of known questions against it to confirm retrieval matches what Cloud returned.

Losing track of third-party keys

Exports exclude third-party API keys, so every model provider and tool credential must be entered again on the self-hosted instance. Teams often discover a missing key only when a workflow node fails in production. Build an inventory from each app's model and tool nodes, record which provider account and key each one used, and assign an owner who confirms each credential works before any traffic moves.

Unnoticed changes in prompts and parameters

Exported prompts and model parameters usually import intact, but the model name, temperature, context length or default provider can differ once the self-hosted workspace resolves providers differently. Outputs then drift without any error. Diff the exported DSL of each app against a fresh export from the new instance, and run a fixed evaluation set on both before switching clients.

API clients still pointing at Cloud

Service API keys are generated per app in each workspace, so keys issued on Cloud do not work on the self-hosted instance, and any client hard-coded to the Cloud base URL keeps calling the old service. Keep a register of every client, its base URL and its key, then switch clients in stages and watch request logs on the old endpoint until traffic reaches zero.

Weak SECRET_KEY handling

The SECRET_KEY signs session cookies and JWTs and encrypts OAuth credentials. Teams that copy a sample value or regenerate it on a later restart will log every user out and can break stored credentials. Generate a unique value before the first start, store it in your secrets manager, back it up with the database, and never change it after users and credentials exist.

Skipping backups and missing usage logs

Upgrades should be preceded by a backup, and the Cloud usage logs needed for audit and cost review do not move with the app. Take a backup of the self-hosted stack before every upgrade, and export or archive the Cloud logs and conversation records you are required to keep before your Cloud workspace is closed, since DSL files do not include them.

Questions buyers ask before moving from Dify Cloud

How much does a migration from Dify Cloud to self-hosted Dify cost?

The cost depends on the scope agreed in writing, not on a standard package. The main components are the infrastructure you run (compute, PostgreSQL, Redis, object storage, a vector store and backups), the staff time spent exporting apps, rebuilding knowledge bases and re-entering credentials, and the engineering effort to cut over API clients. Infrastructure and model provider charges recur, while the migration work is one-time. Ask any quote to separate these lines, to state which apps and knowledge bases are in scope, and to say who holds each credential. Dify's own pricing page lists Cloud Professional at 590 US dollars per year and Team at 1,590 US dollars per year, which is a useful baseline for the subscription you may stop paying after cutover, while the self-hosted Community edition is free and limited to a single workspace.

How long does moving from Dify Cloud to self-hosted take?

Duration depends on inventory more than on the platform itself. Count the apps, the workflow complexity, the number of knowledge bases and the total size of their source documents, the number of provider and tool credentials to re-enter, the MCP servers and API keys to recreate, and the number of external API clients that must switch endpoints. Rebuilding knowledge bases from source files usually takes the most time, because re-indexing depends on document volume and the embedding model in use. Before you commit to a timeline, ask for a written inventory of each item and a plan for the parallel run. No duration is given here because none is supplied for this migration.

Who on our team needs to be involved in the migration?

Three groups of people carry most of the work. Credential holders must supply or re-issue model provider keys, tool credentials and OAuth secrets, because DSL exports do not include third-party API keys. Source document owners must provide the original files for each knowledge base, since Dify knowledge base content is not carried in an app export. API client owners must confirm which products call each Dify app and schedule the switch to new endpoints and new service API keys. Name one person per group before the work starts, and agree who approves each cutover step.

Can our own team migrate apps from Dify Cloud using the DSL export?

Yes, a capable team can move simple apps by exporting each one as a YAML DSL file and importing it into the self-hosted instance, following the app management documentation. The export covers app configuration, workflow nodes, model parameters, prompts and knowledge base connections. It does not cover third-party API keys, knowledge base content or usage logs, so those steps remain manual. Your team will need to test each imported workflow, reconnect knowledge bases, and verify model behavior. Teams without Docker Compose, PostgreSQL, storage and secrets experience often ask for a partner to handle the platform side, the verification plan and the cutover.

Do usage logs and knowledge base content move during the migration?

Neither moves automatically. The DSL export excludes knowledge base content and usage logs, so the original documents must be re-uploaded from their source systems and re-indexed in your deployment. Usage logs stay in Dify Cloud, so decide before cutover which logs you need to keep and export them through the platform's own tooling if available. Confirm this with your Dify account contact, because the export behavior is documented for apps rather than for every data type. Plan retention for any logs that contain personal or regulated data before you export them.

What happens to our Dify Cloud subscription during the parallel run?

Keep the Cloud subscription active until every app, knowledge base and API client has been verified on the self-hosted instance and traffic has moved. Running both environments in parallel means paying for Cloud and for your own infrastructure at the same time, so set an explicit end date tied to the cutover checklist. Cancel or downgrade only after the rollback window has closed. Check your contract for notice periods and data retention after cancellation, and export anything you need before the subscription ends. Confirm these terms with Dify directly, since this page does not set them.

Which parts of the migration are the highest risk?

The highest risks are silent changes to app behavior and broken credentials. An imported workflow can run without errors while using a different model or missing a tool connection, so test outputs against known cases. Credentials that were not re-entered will fail only when a path is executed, which can happen weeks later. Knowledge base retrieval quality can also shift if chunking or the index method differs from the original. Build a verification list per app, keep the Cloud environment available for rollback, and keep your SECRET_KEY and backups documented from day one.

How DeployOpen scopes and delivers a Dify Cloud migration

DeployOpen is a Chainscore Labs company that plans, implements, customizes, integrates, hardens, backs up and documents self-hosted open-source platforms inside your own infrastructure. For a move from Dify Cloud, we start with a written inventory of apps, knowledge bases, credentials and API clients, then build and verify the self-hosted target before any traffic changes.

How we scope

  • We inventory every app, its DSL export, knowledge base source and provider credential owner before work starts.
  • We record which third-party API keys, MCP server connections and tool credentials must be re-entered by a named person.
  • We agree the cutover plan for each API client in the written scope, including which consumers switch first.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we build

  • We deploy the self-hosted target in your cloud account, data center or air-gapped network, with the hosting choices you approve.
  • We rebuild knowledge bases from the source documents you provide, then check retrieval against sample questions you supply.
  • We recreate MCP servers and service API keys, and test each app end to end before it is marked ready.
  • We configure secret handling, backups and outbound request controls so the new deployment is operable from day one.

How we hand over

  • You receive a migration record listing each app, its source, its new location and its verification result.
  • Runbooks cover the credential re-entry steps, the cutover order and the rollback steps for each API client.
  • We walk your operators through the backup, restore and upgrade procedures that apply to your self-hosted environment.
  • Ownership of configuration, documents and access stays with your team once the written scope closes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the migration closes.
  • Retainers can cover monitoring of the new deployment, patch review for each Dify release and post-cutover fixes.
  • Before you request a quote, confirm which apps, knowledge bases and API clients are in scope and who owns each credential.
  • Ask any partner to show how they handle your credentials, source documents and access logs during the work.

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.