The application should only verify the key of the model being used #1069

Closed
opened 2026-02-21 17:29:49 -05:00 by yindo · 2 comments
Owner

Originally created by @huhuhang on GitHub (Feb 19, 2024).

Self Checks

Dify version

0.5.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I have bound the keys of 2 model providers, which are OpenAI and Cohere.

I have created an application that uses models provided by OpenAI.

Today, when using the application, there was a problem, saying that the key for Cohere is a trial version and the request is restricted.

However, my application did not use the Cohere model. This means it also verified the keys for unused models.

20240220-08-44-54-qFdMwBYR

✔️ Expected Behavior

The application should only verify the key of the model being used.

Actual Behavior

No response

Originally created by @huhuhang on GitHub (Feb 19, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version 0.5.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I have bound the keys of 2 model providers, which are OpenAI and Cohere. I have created an application that uses models provided by OpenAI. Today, when using the application, there was a problem, saying that the key for Cohere is a trial version and the request is restricted. However, my application did not use the Cohere model. This means it also verified the keys for unused models. ![20240220-08-44-54-qFdMwBYR](https://github.com/langgenius/dify/assets/5147530/294fca18-8232-4edb-a6c6-1ed2bf556546) ### ✔️ Expected Behavior The application should only verify the key of the model being used. ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 17:29:49 -05:00
yindo closed this issue 2026-02-21 17:29:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 19, 2024):

🤖

Based on the context you've provided, it seems like the Dify application is verifying the keys for both OpenAI and Cohere models because both sets of keys are present in the configuration file.

To resolve this issue, you should ensure that only the OpenAI model credentials are provided in the configuration file. The Cohere model keys should not be present in this configuration file. If they are, remove them to avoid the trial version restriction error.

Here's how you can configure the openai.yaml file:

model_credential_schema:
  model:
    label:
      en_US: Model Name
    placeholder:
      en_US: Enter your model name
  credential_form_schemas:
    - variable: openai_api_key
      label:
        en_US: API Key
      type: secret-input
      required: true
      placeholder:
        en_US: Enter your API Key
    - variable: openai_organization
      label:
        en_US: Organization
      type: text-input
      required: false
      placeholder:
        en_US: Enter your Organization ID
    - variable: openai_api_base
      label:
        en_US: API Base
      type: text-input
      required: false
      placeholder:
        en_US: Enter your API Base
provider_credential_schema:
  credential_form_schemas:
    - variable: openai_api_key
      label:
        en_US: API Key
      type: secret-input
      required: true
      placeholder:
        en_US: Enter your API Key
    - variable: openai_organization
      label:
        en_US: Organization
      type: text-input
      required: false
      placeholder:
        en_US: Enter your Organization ID
    - variable: openai_api_base
      label:
        en_US: API Base
      type: text-input
      required: false
      placeholder:
        en_US: Enter your API Base

Replace the placeholders with your actual OpenAI API key, Organization ID, and API Base (if you have one). The openai_api_key is required, while the openai_organization and openai_api_base are optional.

Please note that I'm unable to view the screenshot you've provided as I cannot see images. If the error persists after making these changes, could you please provide the exact error message in text form? This will help me better understand the issue and provide a more accurate solution.

You can find more information about the configuration file structure and the key verification process in the Dify application in the Dify repository.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 19, 2024): _🤖_ <!-- Answer --> Based on the context you've provided, it seems like the Dify application is verifying the keys for both OpenAI and Cohere models because both sets of keys are present in the configuration file. To resolve this issue, you should ensure that only the OpenAI model credentials are provided in the configuration file. The Cohere model keys should not be present in this configuration file. If they are, remove them to avoid the trial version restriction error. Here's how you can configure the `openai.yaml` file: ```yaml model_credential_schema: model: label: en_US: Model Name placeholder: en_US: Enter your model name credential_form_schemas: - variable: openai_api_key label: en_US: API Key type: secret-input required: true placeholder: en_US: Enter your API Key - variable: openai_organization label: en_US: Organization type: text-input required: false placeholder: en_US: Enter your Organization ID - variable: openai_api_base label: en_US: API Base type: text-input required: false placeholder: en_US: Enter your API Base provider_credential_schema: credential_form_schemas: - variable: openai_api_key label: en_US: API Key type: secret-input required: true placeholder: en_US: Enter your API Key - variable: openai_organization label: en_US: Organization type: text-input required: false placeholder: en_US: Enter your Organization ID - variable: openai_api_base label: en_US: API Base type: text-input required: false placeholder: en_US: Enter your API Base ``` Replace the placeholders with your actual OpenAI API key, Organization ID, and API Base (if you have one). The `openai_api_key` is required, while the `openai_organization` and `openai_api_base` are optional. Please note that I'm unable to view the screenshot you've provided as I cannot see images. If the error persists after making these changes, could you please provide the exact error message in text form? This will help me better understand the issue and provide a more accurate solution. You can find more information about the configuration file structure and the key verification process in the Dify application in the [Dify repository](https://github.com/langgenius/dify). ## Sources - [api/core/model_runtime/model_providers/openai/openai.yaml](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/openai/openai.yaml) - [.github/ISSUE_TEMPLATE/config.yml](https://github.com/langgenius/dify/blob/main/.github/ISSUE_TEMPLATE/config.yml) - [web/app/components/header/account-setting/model-page/utils.ts](https://github.com/langgenius/dify/blob/main/web/app/components/header/account-setting/model-page/utils.ts) <!-- Dosu Comment Footer --> <details open> <summary> #### About Dosu </summary> This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@huhuhang commented on GitHub (Feb 19, 2024):

Found the problem, Cohere's key was used in the knowledge base retrieval

@huhuhang commented on GitHub (Feb 19, 2024): Found the problem, Cohere's key was used in the knowledge base retrieval
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1069