> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Providers

> Add model providers to your workspace so your apps can use LLMs, embedding models, and other AI services

Every Dify app needs at least one model provider. Install a provider, add your API key, and all apps in the workspace can use its models.

<Warning>
  API keys grant workspace-wide model access and trigger direct billing through each provider's account. Only the workspace owner and admins can manage providers.
</Warning>

## Add a Provider

1. In **Integrations** > **Model Provider**, browse the **Install model providers** section or visit the [Marketplace](https://marketplace.dify.ai/) for more options.

2. After installing, click **Setup** on the provider card and enter your API key (and any other required credentials, such as a custom endpoint URL or organization ID). Dify validates the credentials before making the provider available.

## Add a Custom Model

Most providers bring their own models, so once you authorize one, its models are ready to use. You add a model yourself only when the one you need isn't there, typically in two situations:

* You run your own inference server, such as Ollama or Xinference, and Dify has no way to know which models you've loaded.
* A provider lists its models, but the specific one you want, such as a newly released or fine-tuned model, is missing.

Click **Add Model** on the provider card, then give the model a name and its credentials. If a provider only serves a fixed set of models, it won't offer this option.

<Info>
  If you add a custom model whose name and type match one that already exists, Dify attaches the new key to the existing model instead of creating a duplicate.
</Info>

## Manage Credentials

Add more than one key or endpoint to a provider when you want to keep development and production separate, spread usage across accounts, or send different models to different servers.

Where you manage keys depends on the model:

* For a provider's own models, click **Configure** on the provider card to manage the keys shared across all of them.
  <Frame>
    <img src="https://mintcdn.com/dify-4171f9f9/UBmmoVHERrjglfCJ/images/use-dify/workspace/predefined-model-credential.png?fit=max&auto=format&n=UBmmoVHERrjglfCJ&q=85&s=6d4ebd8fa5e6108abf9433f350db881c" alt="Provider Credentials" width="1538" height="678" data-path="images/use-dify/workspace/predefined-model-credential.png" />
  </Frame>
* For a custom model you added, click **Configure** on the model to manage its own keys.

  <Columns cols={2}>
    <Frame>
      <img src="https://mintcdn.com/dify-4171f9f9/UBmmoVHERrjglfCJ/images/use-dify/workspace/custom-model-config.png?fit=max&auto=format&n=UBmmoVHERrjglfCJ&q=85&s=aa5c43e96cd1266626df7fb39de00815" alt="Custom Model Configuration" width="1472" height="270" data-path="images/use-dify/workspace/custom-model-config.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/dify-4171f9f9/UBmmoVHERrjglfCJ/images/use-dify/workspace/custom-model-credential.png?fit=max&auto=format&n=UBmmoVHERrjglfCJ&q=85&s=d68bad1fc8141fee43e3da1e0ea8e96f" alt="Custom Model Credentials" width="1328" height="722" data-path="images/use-dify/workspace/custom-model-credential.png" />
    </Frame>
  </Columns>

  <Warning>
    A model you added relies on its own credentials. Deleting its only credential removes the model too.
  </Warning>

To view every custom model's keys in one place, click **Manage Credentials** on the provider card.

<Frame>
  <img src="https://mintcdn.com/dify-4171f9f9/UBmmoVHERrjglfCJ/images/use-dify/workspace/custom-model-credential-list.png?fit=max&auto=format&n=UBmmoVHERrjglfCJ&q=85&s=5ea53c4ed34c7c6e76fd15b43f0fc927" alt="Manage Credentials for All Custom Models" width="1528" height="692" data-path="images/use-dify/workspace/custom-model-credential-list.png" />
</Frame>

Keys stay here even after you remove a model, so you can re-add the model later without re-entering them.

<Frame>
  <img src="https://mintcdn.com/dify-4171f9f9/UBmmoVHERrjglfCJ/images/use-dify/workspace/removed-custom-model-re-add.png?fit=max&auto=format&n=UBmmoVHERrjglfCJ&q=85&s=f550dae3974ab628a171c2ca073df77a" alt="Re-add a Removed Model" width="1534" height="564" data-path="images/use-dify/workspace/removed-custom-model-re-add.png" />
</Frame>

## Load Balancing

When a model provider has multiple credentials, you can distribute requests across them automatically. Load balancing spreads traffic so no single credential hits its rate limit, which helps maintain throughput under heavy use.

By default, Dify uses a round-robin strategy, routing each request to the next credential in the pool. If a credential triggers a rate limit, it is taken out of rotation for one minute before Dify retries it.

To set it up:

1. Find the model, click **Configure**, and open **Load Balancing**.
2. Add credentials to the load balancing pool, either by selecting existing credentials or adding new ones.
3. Enable at least two credentials, then click **Save**. Models using load balancing are marked with a dedicated icon.

<Frame>
  <img src="https://mintcdn.com/dify-4171f9f9/vMKCXdVD-5Kdilzi/images/add_load_balancing_credential.png?fit=max&auto=format&n=vMKCXdVD-5Kdilzi&q=85&s=256768f6904446580b6dc30f4e4468ea" alt="Add credentials to the load balancing pool" width="1194" height="872" data-path="images/add_load_balancing_credential.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/dify-4171f9f9/mZ12wIe1vYw_wFxp/images/load_balancing_icon.png?fit=max&auto=format&n=mZ12wIe1vYw_wFxp&q=85&s=e2eb7cd7da2b0deec279b61493a8e8d0" alt="A model marked with the load balancing icon" width="1564" height="358" data-path="images/load_balancing_icon.png" />
</Frame>

## Set Default Models

Click **Default Models** in the toolbar to assign the fallback model for each category. Apps and nodes that don't specify a model use these:

* **System Reasoning Model**: the default LLM.
* **Embedding Model**: used for knowledge base indexing and retrieval.
* **Rerank Model**: re-ranks retrieval results by relevance.
* **Speech-to-Text Model**: converts audio input to text.
* **Text-to-Speech Model**: converts text responses to audio.
