[PR #24451] feat: add multi model credentials #30638

Closed
opened 2026-02-21 20:47:56 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/24451

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

add multi model credentials for provider and custom models.

changes:

  • Introduced APIs for managing individual provider credentials, including adding, deleting, modifying, querying, and selectively activating them.
  • Introduced APIs for managing individual custom-model credentials, including adding, deleting, modifying, querying, and selectively activating them.
  • Deprecated the existing APIs for adding and deleting providers.
  • Updated the /workspaces/current/model-providers API for improved functionality.
  • Enhanced the /workspaces/current/model-providers/<path:provider>/models/credentials API.
  • Revised the /workspaces/current/model-providers/<path:provider>/models API.
  • Added new database tables: provider_credentials and provider_model_credentials.
  • Introduced a new credential_id field to the providers and load_balancing_model_configs tables.
  • Removed the encrypted_config field from the providers table.
  • Developed migration scripts to transfer encrypted_config data from the providers table to the provider_credentials table and from the provider_models table to the provider_model_credentials table.
  • Refactored provider configuration, leveraging the new SQLAlchemy interface and eliminating unused or deprecated methods and parameters.

Screenshots

image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/24451 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary add multi model credentials for provider and custom models. changes: - Introduced APIs for managing individual provider credentials, including adding, deleting, modifying, querying, and selectively activating them. - Introduced APIs for managing individual custom-model credentials, including adding, deleting, modifying, querying, and selectively activating them. - Deprecated the existing APIs for adding and deleting providers. - Updated the `/workspaces/current/model-providers` API for improved functionality. - Enhanced the `/workspaces/current/model-providers/<path:provider>/models/credentials` API. - Revised the `/workspaces/current/model-providers/<path:provider>/models` API. - Added new database tables: `provider_credentials` and `provider_model_credentials`. - Introduced a new `credential_id` field to the `providers` and `load_balancing_model_configs` tables. - Removed the `encrypted_config` field from the `providers` table. - Developed migration scripts to transfer `encrypted_config` data from the `providers` table to the `provider_credentials` table and from the `provider_models` table to the `provider_model_credentials` table. - Refactored provider configuration, leveraging the new SQLAlchemy interface and eliminating unused or deprecated methods and parameters. ## Screenshots <img width="3024" height="1964" alt="image" src="https://github.com/user-attachments/assets/b312f205-dd0c-42c0-bd89-5e50643195ef" /> ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:47:56 -05:00
yindo closed this issue 2026-02-21 20:47:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30638