Dify migration from Dify Cloud or other LLM tools

Moving AI apps from Dify Cloud or another LLM tool onto self-hosted Dify is mostly a rebuild of data, secrets and integrations, not a copy. This page explains what the work covers, what drives its cost and what you must provide.

On this page

What a Dify migration involves

A Dify migration starts with YAML DSL export and import, but that step only moves app definitions. According to the Dify docs, exports carry app configuration, workflow nodes, model parameters, prompts and knowledge base connections. They do not carry third-party API keys, knowledge base document content or usage logs. Plan to re-enter every model provider credential and tool key on the target instance, re-upload or re-index every knowledge base source, and accept that run history stays behind in the source system.

Most moves are triggered by one of three situations: leaving Dify Cloud for data residency or direct control of the infrastructure, consolidating several Dify or other LLM tool instances into one environment, or porting flows from another tool. Each trigger changes the work. A cloud-to-self-hosted move is mostly a re-keying and re-indexing exercise. A consolidation may need workspace mapping and name conflict decisions. A port from another tool means redesigning prompts and node logic, because no export format carries them over directly.

A team that already runs Docker or Kubernetes and knows Dify well can often move a handful of simple apps itself. The work is mainly export, import, credential entry and testing. Larger app catalogs, many knowledge bases and sensitive credentials usually justify a fixed-scope partner engagement, since the risks sit in secret handling, re-indexing and verification rather than in the import itself. Ask any partner to state the app inventory, knowledge base count, credential list and acceptance tests in writing before work starts.

DSL import is the starting point, not the whole job. Before cutover, confirm the target version matches the source behavior, check that model providers and tools resolve on the new instance, rebuild each knowledge base and compare retrieval results on a fixed set of test questions, and check that app access and workspace roles match what users had before. Keep the source instance running until these checks pass.

What the migration work includes

The migration breaks into seven work packages, from inventory through cutover, and ends with a defined set of handover deliverables. Each package has a different owner and a different failure mode, so scope them separately in the written proposal.

Inventory of apps and dependencies

Every app, workflow, knowledge base, tool, model provider and user account is listed with its owner and its dependencies. This inventory sets the scope for every other package. Check that it covers apps shared across workspaces and apps that call Dify through the backend-as-a-service APIs, since those callers break silently if the endpoint or key changes.

DSL export and import

Apps are exported and imported as YAML DSL files, which carry app configuration, workflow nodes, model parameters, prompts and knowledge base connections. The DSL does not carry third-party API keys, knowledge base content or usage logs. Validate each imported app against its source, because references to knowledge bases and tools may need manual relinking after import.

Knowledge base rebuild

Knowledge base documents are not part of the export, so each knowledge base is rebuilt from its original sources. The team records which document sources are used, plus the chunking and indexing settings for each base. Retrieval results are compared before and after the rebuild, because a change in chunk size alters the answers the apps return.

Credential re-entry and register

Model provider keys and tool credentials are entered again in the target environment, and each one is recorded in a credential register with its owner, scope and rotation date. Use separate keys for the new environment where the provider supports it, and confirm the encryption setup for stored secrets before entering production keys.

Porting from other LLM tools

Prompts and flows from other tools are mapped node by node to Dify node types, such as LLM, knowledge retrieval, conditional and code nodes. Expect some logic to need redesign rather than a direct mapping. Record each mapping decision so that reviewers can trace why a node behaves differently from the original tool.

Testing against expected outputs

Each app is tested against outputs recorded from the source system, using the same inputs where possible. Agree in advance which differences are acceptable, such as wording variation, and which are failures, such as a missing tool call or a wrong knowledge base result. The test evidence is kept as a deliverable for the change record.

Cutover and rollback path

Cutover moves users and API callers to the self-hosted instance in a planned window, with the source system kept available for rollback. Confirm in writing who can trigger rollback, how API endpoints are switched back, and how data written during the window is handled. Take a backup of the target before cutover, as recommended before any Dify upgrade.

What drives migration effort

This table lists each driver of migration effort, why it changes the work and how to keep it down, and it assumes an app inventory with a stated expected output for every app before scoping starts.

DriverWhy it mattersHow to keep it down
Number of apps and workflowsEach app needs its own DSL import, configuration check and test pass, and node count sets how much verification each one needs.Inventory every app with its owner and expected output before scoping. Retire unused apps first.
Knowledge bases and source documentsDocument content is not exported, so each knowledge base is rebuilt from source files, and document volume drives indexing and checks.Keep source files in a known location. Remove stale or duplicate documents before re-indexing.
Model providers and API keysKeys are not exported and must be re-entered and tested for each provider in each workspace.List every provider and key owner up front. Confirm which keys are valid for the new environment.
Custom tools and internal API integrationsEach integration needs a network path from the self-hosted stack, valid credentials and a fresh test run.Document endpoints, authentication methods and network routes. Confirm reachability from the target network early.
Code nodes in the sandboxCode nodes run in the sandbox, so libraries, timeouts and outbound calls must be checked against the target settings.List imports and outbound calls for each code node. Test them in staging with the same sandbox settings.
Flows ported from other toolsPrompts and logic from other tools are rebuilt as Dify nodes, and outputs must be compared against the original behavior.Map each source step to a Dify node. Agree on the expected output for each ported flow before rebuilding.
Environments (dev, test, production)Each environment needs its own keys, storage, knowledge bases and DSL imports, so every extra environment repeats checks.Agree on the fewest environments the team can run. Promote DSL files through one path with a written checklist.
Users, workspaces and access structureRoles, workspace layout and web app access must be recreated. The Community edition is limited to a single workspace.Map current roles to target roles. Decide the workspace count and confirm the edition before import.
Compliance evidence for cutoverAssessors may ask for configuration, access and backup records taken at cutover. Auditors issue assessment results, not DeployOpen.Agree the evidence list with your assessor before cutover. Collect records during testing, not after go-live.

Migration phases and outputs

The sequence moves each app, its data and its credentials onto a self-hosted Dify in a controlled order, and each phase closes with a record the team can check.

  1. Inventory source apps and data

    Your team lists every app, workflow, knowledge base, model provider, plugin and integration on the source platform, with its owner and active users. The output is an app inventory and a dependency map showing which API keys, external tools and documents each app relies on. The step is done when every app has a disposition: migrate, rebuild, retire or keep in place.

  2. Design the target platform

    Choose Docker Compose or Kubernetes, the metadata database (PostgreSQL is the default), file storage, the vector store and the Dify version to target. Check the prerequisites and the release notes for that version before committing. The output is a design record and a version decision that the owners sign off before any build starts.

  3. Build the environment and secrets

    Deploy the target Dify instance in your infrastructure and set SECRET_KEY, database and storage settings through your secrets store. Record SECRET_KEY before first use, since changing it after deployment logs out all users. The output is a build record and a secrets register, confirmed by a working administrator login and a passing health check.

  4. Export, import and check DSL compatibility

    Export each app as a YAML DSL file from the source and import it into the target workspace. Exports carry app configuration, workflow nodes, model parameters, prompts and knowledge base connections, but they exclude third-party API keys, knowledge base content and usage logs. The output is a compatibility report per app that lists nodes or settings needing manual edits on the target version.

  5. Rebuild knowledge bases and re-enter credentials

    Recreate each knowledge base on the target, upload the source documents again and re-index them with the chosen vector store and embedding settings. Re-enter each model provider and third-party API key through a controlled process, logging the owner and the date of each entry. The output is a knowledge base rebuild log and a credential register.

  6. Port flows, test and pilot

    Repair the prompts and workflows that failed the compatibility check, then run a test matrix covering each app, input type, tool call and knowledge base query. A pilot group of actual users then works in the target for a set period. The output is a test matrix with pass or fail results and a pilot feedback log that the owners review before cutover.

  7. Cut over and decommission the source

    Freeze changes on the source, run a final DSL and credential check, and switch users and API callers to the target using a cutover checklist. Confirm each integration responds, then keep the source read-only for the retention period your policy sets. The output is a signed cutover checklist and a decommissioning record with archived exports and logs.

Which parts stay in-house and which go to a partner

This table shows, for each part of a Dify migration, whether your team usually keeps it, a partner usually takes it, or both share it, along with the skills each part needs.

Work partUsually kept in-houseUsually outsourcedSkills needed
Inventory and business owner sign-offYour team lists apps, owners, knowledge bases and model providers, and business owners approve what moves and what retiresPartner may draft the inventory template and run the discovery workshopsBusiness process knowledge, app ownership mapping, change approval
Target infrastructure buildEither: your platform team can build the hosts, network and storageEither: a partner can build the Compose or Kubernetes stack in your accounts or data centerDocker or Kubernetes operations, PostgreSQL and object storage administration
DSL migration and knowledge base rebuildReview of imported apps and sign-off on behaviorOften a partner for volume, since document content must be re-uploaded and re-indexedDify app editing, document ingestion, chunking and retrieval tuning
Credential handling and key storageOwner of API keys, the SECRET_KEY and key storage decisions, who issues and rotates provider accountsPartner supports secret rotation scripts, re-entry procedures and documentationLLM provider accounts, security review, secrets management
Porting from other toolsPrompt and flow owners confirm intent and accept behavior changesPartner when node mapping from another tool is non-trivial or needs custom codePrompt and flow ownership, workflow design, source tool expertise
Testing and acceptanceBusiness owners run acceptance tests on real questions and sign off resultsPartner writes test sets, compares outputs and records regressionsPrompt and flow ownership, evaluation design, security review of outputs
Cutover and decommissioningYour owner schedules the switch, updates user links and retires the Dify Cloud workspace or old toolPartner may prepare runbooks and rollback stepsOperations ownership, access control, LLM provider account administration

What usually goes wrong and how to prevent it

Most failures in this move come from wrong assumptions about what a DSL export carries and how the target runtime enforces its rules. Each risk below has a prevention step to build into the scope before cutover.

Knowledge bases assumed to move

A DSL export keeps knowledge base connections but leaves out document content, so the target workspace starts with empty or missing indexes. Teams that treat the move as a file copy find this at cutover. Inventory each knowledge base, its source files and chunking settings, plan a re-ingestion step, and check retrieval answers against the source.

Keys and SECRET_KEY set late

Model provider and tool API keys are not in the export, so they get re-entered app by app, often after users have started testing. Keep a credential register that names each key, its owner and its target environment. Set SECRET_KEY once before the first login, because changing it after deployment logs out every user.

Version mismatch on import

A DSL written for one Dify release can contain settings or variables that another release reads differently or rejects. Pin the target version before scoping, read the release notes for each minor version between source and target, and test an import of every app on that exact build. Plan the upgrade path for later releases, which arrive roughly monthly.

Tools and code nodes in the sandbox

Tools that call internal systems can fail because the SSRF proxy blocks internal and private IP ranges by design. Code nodes run in the sandbox, which can behave differently from the source environment. Request an allowlist entry for each internal endpoint with its owner, then run every code node in the target with representative inputs before go-live.

Prompt output drift by model

A prompt tuned on one model provider or model version can return different wording, structure or refusals on another. Build a per-app test matrix that lists each prompt, model, version and the output checks it must pass, such as JSON shape and tool-call behavior. Rerun the matrix whenever the provider or model version changes.

Flows that stop at cutover

Undocumented automations, such as scheduled runs, webhooks or apps embedded in other tools, can stop when the source workspace is turned off. Inventory every trigger, endpoint and consumer before scoping, then run source and target in parallel for an agreed period while outputs are compared. Retire the source only after the comparison passes.

How the work changes by starting point

Moving from Dify Cloud is mostly a rebuild. Each app can be exported as a YAML DSL file that carries app configuration, workflow nodes, model parameters, prompts and knowledge base connections. Everything else must be recreated on the self-hosted instance.

  • Re-enter API keys: exports do not include third-party API keys, so every model and tool credential is entered again.
  • Rebuild knowledge bases: document content is not exported, so source files must be re-uploaded and indexed.
  • Check connections: confirm each knowledge base reference points to a dataset that exists on the new instance.
  • Review multi-tenant use: the Dify Open Source License prohibits running a multi-tenant environment, where one tenant is one workspace, without written authorization. Confirm the terms before you run one.
  • Plan for usage history: usage logs are not part of the export, so decide whether any historical data must be kept elsewhere.

What you need to provide before the work starts

Before any migration work starts, your team has to hand over a defined set of inputs. The migration cannot be scoped or cut over without them, and the largest readiness gap we usually see is not technical: it is that no one owns each app. Assign one named business owner per app before the project begins, and make that person responsible for approving what the app should output.

On the source side, provide an account with owner rights on the Dify Cloud workspace, and an export of each app's YAML DSL file. DSL exports carry app configuration, workflow nodes, model parameters, prompts and knowledge base connections, but not third-party API keys, knowledge base documents or usage logs. Also provide a list of every app in use, with its owner, its users and its dependencies. For knowledge bases, supply the original source documents or their storage locations, since document content must be re-ingested on the new platform.

Next, build a register of model provider accounts and tool credentials, with the named owner of each. Each key will need to be re-entered in the self-hosted instance, so the owner must be able to rotate or reissue it. On the target side, confirm the infrastructure or cloud accounts, their access rules and who grants and reviews access. Decide the Dify version to deploy, the metadata database (PostgreSQL is the default, MySQL and OceanBase are listed as options), the vector store and the object storage provider before design starts, because each choice changes the build.

Finally, name the test users who will compare outputs against the source apps, and agree a cutover window with a named rollback owner who can make the call to revert. Confirm that test users can reach both environments during the parallel run. If you are migrating from another LLM tool rather than Dify Cloud, the same register applies, but expect to supply prompts and flow definitions in a readable form, since there is no DSL file to export. Confirm each item with your own owners and environment before the scope is agreed in writing.

Frequently asked questions

Does a Dify DSL export include knowledge bases and API keys?

No. A DSL file carries app configuration, workflow nodes, model parameters, prompts and knowledge base connections, but not third-party API keys, knowledge base content or usage logs. Plan to do three things by hand: re-enter every model provider and tool credential in the new workspace, re-upload or re-sync the source documents into new knowledge bases, and confirm each connection points to the right dataset after import. Ask your partner to list these items per app in the written scope.

What drives the effort of a Dify migration?

Effort follows the inventory: how many apps, how many workflows and nodes per app, how many knowledge bases and how large their source documents are, how many model providers and external tools each app calls, and how much output testing your owners require. Ask a partner to quote each of these separately, along with environment setup, test runs, cutover support and handover. A written scope should name which apps are in and which are out.

How long does a Dify migration take?

The duration depends on the inventory rather than on a standard number of days. A small set of apps without knowledge bases moves much faster than dozens of workflows backed by large document collections that must be re-indexed. Ask for a timeline tied to the agreed app list, with dependencies such as document access, credential approval and test sign-off marked as client-side tasks that can delay the schedule.

Can our own team migrate from Dify Cloud without a partner?

Yes, a capable team can export DSL files, import them into a self-hosted instance and rebuild knowledge bases itself. The work that usually needs experienced hands is the environment build, secrets handling, access design, backup setup and structured testing of outputs. Decide which of these your team will own before you start, and ask a partner to quote only the parts you choose to hand over.

Does migration keep prompts and flows exactly the same?

Migration preserves the exported configuration, including prompts, workflow nodes and model parameters. It does not guarantee identical output, because a different model provider, model version or retrieval setup can change responses. Test each app against its expected results on the new model setup before cutover, and record acceptance criteria in the scope. Prompts and flows from other LLM tools usually need manual porting and the same testing.

Do we need to upgrade Dify during the migration?

Not necessarily, but you should confirm the version before you import. Dify ships minor releases roughly monthly, and each release has its own upgrade guide, new .env variables and security changes. Read the release notes for the target version, take a backup before any upgrade, and check .env.example after upgrading. Ask your partner to state which Dify version the migration targets and how later upgrades are handled.

How DeployOpen scopes and delivers Dify migrations

DeployOpen moves Dify apps from Dify Cloud or other LLM tools into a self-hosted Dify that runs in infrastructure you control, treating exports, knowledge bases and credentials as separate workstreams. Each engagement is scoped in writing before work starts.

How we scope

  • Inventory every Dify Cloud app, workflow and agent in scope, noting which ones depend on knowledge bases, plugins or custom tools.
  • Record which model providers, API keys and external tools each app uses, so credentials can be re-entered securely on the new instance.
  • Agree in writing which apps, knowledge bases and source tools are covered, plus the acceptance checks that close each migration item.

How we build

  • Export apps as YAML DSL files and import them into the self-hosted instance, then review prompts, workflow nodes and model parameters for drift.
  • Rebuild knowledge bases from the original source documents, since document content is not carried in the DSL export.
  • Port prompts and flows from other LLM tools by mapping their logic to Dify workflow nodes, and test each ported app against recorded sample inputs.

How we hand over

  • Deliver a migration log listing each app, its import status, rebuilt knowledge bases, re-entered credentials and open items.
  • Document the deployment, environment settings and backup steps, so your team can repeat the process for future apps.
  • Walk your operators through the running instance, including who holds credentials and where secrets are stored.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after the migration closes.
  • Confirm with your team how you want to handle later Dify releases, which arrive roughly monthly, and how backups are taken before each upgrade.
  • Ask for the support scope, response expectations and change process in the written quote before the engagement starts.

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.