dify icon indicating copy to clipboard operation
dify copied to clipboard

Setup OpenRouter fails with "Credentials validation failed with status code 402"

Open LiviaH opened this issue 1 year ago • 3 comments

Self Checks

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

Dify version

0.11.0

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. login to openrouter.ai
  2. Create a Key
  3. Copy the Key
  4. login to cloud.dify.ai
  5. go to Settings -> Model Provider
  6. find "OpenRouter" and click "Setup"
  7. paste the openrouter key into "API Key" field
  8. click "Save"
  9. popup with message "Credentials validation failed with status code 402" is shown

✔️ Expected Behavior

the API key is accepted and OpenRouter can used with API Key

❌ Actual Behavior

error occures, message: "Credentials validation failed with status code 402"

LiviaH avatar Nov 13 '24 18:11 LiviaH

Hey @LiviaH! 👋 I'm here to assist you with bug fixes, answer your questions, and help you become a contributor. Let's tackle this issue together!

I couldn't find specific information about the status code 402 in the context of Dify's OpenRouter integration. However, I did find a similar closed issue related to setting the OpenAI API key, which might provide some insights or potential solutions. You can check the closed issue here and see if any of the discussions or solutions there are applicable to your situation [1].

If the issue persists, consider checking if there are any recent changes or updates in Dify version 0.11.0 that might affect the OpenRouter API key validation process, as this could be a contributing factor.

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Nov 13 '24 18:11 dosubot[bot]

issue #1526 is not similar, you mix OpenRouter and OpenAI integration which are different cases. I assume the OpenRouter specific implementation needs to reviewed.

LiviaH avatar Nov 13 '24 19:11 LiviaH

Hi, @LiviaH. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • Bug reported in Dify version 0.11.0 regarding OpenRouter setup.
  • Error encountered: "Credentials validation failed with status code 402" when saving an API key.
  • I suggested checking a similar issue, but you clarified the difference and pointed out the need for a review of the OpenRouter-specific implementation.
  • The issue remains unresolved, requiring further investigation into the OpenRouter integration.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Dify repository. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Dec 15 '24 16:12 dosubot[bot]

Still the same behavior in dify.ai 14.2. openrouter is on the list of model providers but is not usable. Adding the API Key is not possible and produces an error with the message "Credentials validation failed with status code 402"

LiviaH avatar Dec 27 '24 17:12 LiviaH

I got same issue in latest version of dify.ai also self-host and cloud platform when I add deepseek model

sean-escaped avatar Jan 16 '25 12:01 sean-escaped

This issue is still encountered in Dify version 0.15.3, i.e., the OpenRouter API Key cannot be configured, but a single model can be added successfully

guangchen017 avatar Feb 22 '25 14:02 guangchen017

Still encountering this problem with deepseek

Ennazk avatar Feb 27 '25 15:02 Ennazk

Still encountering the same issue with DeepSeek. @crazywoola

LukaBanovic avatar Mar 13 '25 09:03 LukaBanovic

Still the same issue with deepseek

Pixel2075 avatar Mar 16 '25 19:03 Pixel2075

This issue is still valid, the ticket should be open and not closed

donnib avatar Mar 19 '25 17:03 donnib

Still the same issue with deepseek

Arosy47 avatar Mar 25 '25 03:03 Arosy47

same issue with deepseek

Andy7596183 avatar Mar 25 '25 06:03 Andy7596183

same errors when setting deepseek API key

xjxtree avatar Mar 27 '25 08:03 xjxtree

same issus

zismylove avatar Apr 09 '25 01:04 zismylove

same errors when setting deepseek API key

Aleegra avatar Apr 09 '25 02:04 Aleegra

check your deepseek account balance first.

xjxtree avatar Apr 09 '25 03:04 xjxtree

same errors when setting deepseek API key.time: 2025/4/26.

fafactx avatar Apr 26 '25 11:04 fafactx

I'm getting the same error with Open Router.

ehubb20 avatar May 02 '25 15:05 ehubb20

I have the same error with openrouter api key in self hosted dify

cyberjob001 avatar May 13 '25 13:05 cyberjob001

I have the same error with openrouter api key in self hosted dify

+1,how to slove this error,this is important for me.

badspider7 avatar May 22 '25 01:05 badspider7

Please reopen this issue. I have this issue with qwen/qwen3-coder:free

fengwang avatar Aug 13 '25 14:08 fengwang

@crazywoola Please consider reopening this issue.

fengwang avatar Aug 13 '25 14:08 fengwang