Error reported when uploading a model using OpenAI-API-compatible #614

Closed
opened 2026-02-16 10:19:55 -05:00 by yindo · 1 comment
Owner

Originally created by @Nolan-Yin on GitHub (Sep 4, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.6.0

Plugin version

OpenAI-API-compatible==0.0.19

Cloud or Self Hosted

Cloud

Steps to reproduce

Use the 'openai'api_compatible' plugin to upload the model, and the upload is successful (the successful model is displayed in the frontend list).
Then when creating the application, an error message ''' Use the "openai'api_compatible" plugin to upload a model, which shows that the upload was successful (the model is successfully displayed in the frontend list). Then, when creating an application, select the model and try running it, an error message will appear with the error message "[openai'api_compatible] Error: PluginInvoke Error: {" rgs ": {" description ":" [models] Error: API request failed with status code 401: {\ "error ": {\ "message ": \ "Incorrect API key provided. " code \ ": " invalid_mapi_key \ "}, " request_id \ ": " 99eb87a4-50d6-9c0e-b667-08d6a53e5ee5 \ "}"}, "err_type": "Invoke Error", "message":"[models] Error: API request failed with status code 401: {"error":{"message":"Incorrect API key provided. ","type":"invalid_request_error","param":null,"code":"invalid_api_key"},"request_id":"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5"}"}''', Display 'model xxxxx credentials is not initialized' when 'go to chat' on the application.

Image

It is worth mentioning that when using admin tenants to perform the above operations, this situation was not encountered. And when using other plugins (通义千问) to upload the same model, it can also be used normally.

✔️ Error log

'''
[openai_api_compatible] Error: PluginInvokeError: {"args":{"description":"[models] Error: API request failed with status code 401: {"error":{"message":"Incorrect API key provided. ","type":"invalid_request_error","param":null,"code":"invalid_api_key"},"request_id":"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5"}"},"error_type":"InvokeError","message":"[models] Error: API request failed with status code 401: {"error":{"message":"Incorrect API key provided. ","type":"invalid_request_error","param":null,"code":"invalid_api_key"},"request_id":"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5"}"}
'''
/////
'''' Model qwen-plus-latest credentials is not initialized '''

Originally created by @Nolan-Yin on GitHub (Sep 4, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.6.0 ### Plugin version OpenAI-API-compatible==0.0.19 ### Cloud or Self Hosted Cloud ### Steps to reproduce Use the 'openai'api_compatible' plugin to upload the model, and the upload is successful (the successful model is displayed in the frontend list). Then when creating the application, an error message ''' Use the "openai'api_compatible" plugin to upload a model, which shows that the upload was successful (the model is successfully displayed in the frontend list). Then, when creating an application, select the model and try running it, an error message will appear with the error message "[openai'api_compatible] Error: PluginInvoke Error: {" rgs ": {" description ":" [models] Error: API request failed with status code 401: {\ "error \": {\ "message \": \ "Incorrect API key provided. \" code \ ": \" invalid_mapi_key \ "}, \" request_id \ ": \" 99eb87a4-50d6-9c0e-b667-08d6a53e5ee5 \ "}"}, "err_type": "Invoke Error", "message":"[models] Error: API request failed with status code 401: {\"error\":{\"message\":\"Incorrect API key provided. \",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_api_key\"},\"request_id\":\"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5\"}"}''', Display 'model xxxxx credentials is not initialized' when 'go to chat' on the application. <img width="327" height="340" alt="Image" src="https://github.com/user-attachments/assets/c936b627-30b2-4a06-9bb7-1b9dba465b13" /> It is worth mentioning that when using admin tenants to perform the above operations, this situation was not encountered. And when using other plugins (通义千问) to upload the same model, it can also be used normally. ### ✔️ Error log ''' [openai_api_compatible] Error: PluginInvokeError: {"args":{"description":"[models] Error: API request failed with status code 401: {\"error\":{\"message\":\"Incorrect API key provided. \",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_api_key\"},\"request_id\":\"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5\"}"},"error_type":"InvokeError","message":"[models] Error: API request failed with status code 401: {\"error\":{\"message\":\"Incorrect API key provided. \",\"type\":\"invalid_request_error\",\"param\":null,\"code\":\"invalid_api_key\"},\"request_id\":\"99eb87a4-50d6-9c0e-b667-08d6a53e5ee5\"}"} ''' ///// '''' Model qwen-plus-latest credentials is not initialized '''
yindo added the bug label 2026-02-16 10:19:55 -05:00
yindo closed this issue 2026-02-16 10:19:55 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 4, 2025):

Hi @Nolan-Yin! I'm Dosu and I’m helping the dify-official-plugins team.

The "Incorrect API key provided" and "credentials is not initialized" errors with the OpenAI-API-compatible plugin are almost always caused by missing, invalid, or improperly configured API keys in the model provider settings. For non-admin tenants, credentials must be explicitly initialized and linked to each model/provider—admin tenants often bypass this due to global or default credential access, which is why they don't see the issue. Recent Dify updates have introduced more granular, per-model credential management and new UI flows for credential selection, especially for non-admins. If credentials are not properly set or selected during model upload, you'll see these errors in the UI and logs. Make sure the API key is correctly entered in the provider settings, and that the credential is explicitly initialized and selected for the model you want to use. If your Dify Cloud instance has recently updated, you may need to revisit the credential setup for each model to ensure compatibility with the new multi-credential system and UI flows. More details and similar issues are discussed here and here. Recent PRs like #24451 and #24994 have changed credential handling, so reviewing your credential setup is recommended.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 4, 2025): <!-- Greeting --> Hi @Nolan-Yin! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify-official-plugins team. <!-- Answer --> The "Incorrect API key provided" and "credentials is not initialized" errors with the OpenAI-API-compatible plugin are almost always caused by missing, invalid, or improperly configured API keys in the model provider settings. For non-admin tenants, credentials must be explicitly initialized and linked to each model/provider—admin tenants often bypass this due to global or default credential access, which is why they don't see the issue. Recent Dify updates have introduced more granular, per-model credential management and new UI flows for credential selection, especially for non-admins. If credentials are not properly set or selected during model upload, you'll see these errors in the UI and logs. Make sure the API key is correctly entered in the provider settings, and that the credential is explicitly initialized and selected for the model you want to use. If your Dify Cloud instance has recently updated, you may need to revisit the credential setup for each model to ensure compatibility with the new multi-credential system and UI flows. More details and similar issues are discussed [here](https://github.com/langgenius/dify-official-plugins/issues/986) and [here](https://github.com/langgenius/dify-official-plugins/issues/498). Recent PRs like [#24451](https://github.com/langgenius/dify/pull/24451) and [#24994](https://github.com/langgenius/dify/pull/24994) have changed credential handling, so reviewing your credential setup is recommended. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/dceb5afc-8af5-49ec-a137-6b26c9ba720b?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1650)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#614