failed to add cohere key #1077

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

Originally created by @magein on GitHub (Feb 20, 2024).

Originally assigned to: @takatost, @crazywoola on GitHub.

Self Checks

Dify version

0.5.6

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

version
403
添加从cohere中获取的key点击确定出现403的错误。
key是Trial keys(free)类型的,是不是只能添加Production 类型的key

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @magein on GitHub (Feb 20, 2024). Originally assigned to: @takatost, @crazywoola on GitHub. ### 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.6 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![version](https://github.com/langgenius/dify/assets/16146901/6c25b0f6-621a-4830-8da7-658096d92e04) ![403](https://github.com/langgenius/dify/assets/16146901/c851294d-fc0c-42b0-9d16-ffa9eeaca6c3) 添加从cohere中获取的key点击确定出现403的错误。 key是Trial keys(free)类型的,是不是只能添加Production 类型的key ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 17:29:51 -05:00
yindo closed this issue 2026-02-21 17:29:51 -05:00
Author
Owner

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

🤖

你好 @Magein,很高兴再次见到你!遇到什么问题了吗?

对于从Cohere添加key的过程,您需要在cohere.yaml文件的provider_credential_schema部分提供API key。这是相关的部分:

provider_credential_schema:
  credential_form_schemas:
    - variable: api_key
      label:
        zh_Hans: API Key
        en_US: API Key
      type: secret-input
      required: true
      placeholder:
        zh_Hans: 在此输入您的 API Key
        en_US: Enter your API Key
      show_on: [ ]

在这个部分,您可以看到api_key是必需的(required: true)。typesecret-input,这意味着出于安全原因,输入应该被隐藏。placeholder为用户提供了他们应该在这个字段中输入什么的提示。

要添加key,将占位符文本替换为您的实际API key。请注意,实际的修改可能会在基于此模式生成的用户界面中完成,或者在应用程序存储这些凭据的其他位置完成,这取决于应用程序的设计。

关于用户尝试添加Cohere key时显示的确切错误消息,上下文中并未明确提到。然而,可以推断出错误消息是动态生成的,并作为prop传递给ValidatedErrorMessage组件。然后,错误消息将与'common.provider.validatedError'键的翻译字符串一起显示。

确切的错误消息将是传递给ValidatedErrorMessage组件的errorMessage prop的值。

请注意,'common.provider.validatedError'的实际文本在上下文中没有提供,它将在应用程序的i18n翻译文件中找到。

如果您需要确切的错误消息,您需要检查使用ValidatedErrorMessage组件和传递errorMessage prop的代码部分。

关于需要使用的特定类型的key(试用key vs 生产key),代码并未指定试用key和生产key之间的任何区别。key是使用ApiToken.generate_api_key方法生成的,并与特定的资源类型('app'或'dataset')关联,如resource_type属性所示。在提供的上下文中没有提到或指示试用或生产key。因此,可以推断出,根据给定的上下文,没有需要使用的特定类型的key(试用key vs 生产key)。

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 20, 2024): _🤖_ <!-- Greeting --> 你好 @Magein,很高兴再次见到你!遇到什么问题了吗? <!-- Answer --> 对于从Cohere添加key的过程,您需要在`cohere.yaml`文件的`provider_credential_schema`部分提供API key。这是相关的部分: ```yaml provider_credential_schema: credential_form_schemas: - variable: api_key label: zh_Hans: API Key en_US: API Key type: secret-input required: true placeholder: zh_Hans: 在此输入您的 API Key en_US: Enter your API Key show_on: [ ] ``` 在这个部分,您可以看到`api_key`是必需的(`required: true`)。`type`是`secret-input`,这意味着出于安全原因,输入应该被隐藏。`placeholder`为用户提供了他们应该在这个字段中输入什么的提示。 要添加key,将占位符文本替换为您的实际API key。请注意,实际的修改可能会在基于此模式生成的用户界面中完成,或者在应用程序存储这些凭据的其他位置完成,这取决于应用程序的设计。 关于用户尝试添加Cohere key时显示的确切错误消息,上下文中并未明确提到。然而,可以推断出错误消息是动态生成的,并作为prop传递给`ValidatedErrorMessage`组件。然后,错误消息将与'common.provider.validatedError'键的翻译字符串一起显示。 确切的错误消息将是传递给`ValidatedErrorMessage`组件的`errorMessage` prop的值。 请注意,'common.provider.validatedError'的实际文本在上下文中没有提供,它将在应用程序的i18n翻译文件中找到。 如果您需要确切的错误消息,您需要检查使用`ValidatedErrorMessage`组件和传递`errorMessage` prop的代码部分。 关于需要使用的特定类型的key(试用key vs 生产key),代码并未指定试用key和生产key之间的任何区别。key是使用`ApiToken.generate_api_key`方法生成的,并与特定的资源类型('app'或'dataset')关联,如`resource_type`属性所示。在提供的上下文中没有提到或指示试用或生产key。因此,可以推断出,根据给定的上下文,没有需要使用的特定类型的key(试用key vs 生产key)。 ## Sources - [api/core/model_runtime/model_providers/cohere/cohere.yaml](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/cohere/cohere.yaml) - [web/app/components/header/account-setting/key-validator/ValidateStatus.tsx](https://github.com/langgenius/dify/blob/main/web/app/components/header/account-setting/key-validator/ValidateStatus.tsx) - [api/controllers/console/apikey.py](https://github.com/langgenius/dify/blob/main/api/controllers/console/apikey.py) <!-- 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

@crazywoola commented on GitHub (Feb 20, 2024):

Try to remove all the old keys and use this command flask reset-encrypt-key-pair to reset all encryption keys.

https://docs.dify.ai/getting-started/install-self-hosted/install-faq#id-1.-how-to-reset-the-password-if-the-local-deployment-initialization-fails-with-an-incorrect-password

@crazywoola commented on GitHub (Feb 20, 2024): Try to remove all the old keys and use this command `flask reset-encrypt-key-pair` to reset all encryption keys. https://docs.dify.ai/getting-started/install-self-hosted/install-faq#id-1.-how-to-reset-the-password-if-the-local-deployment-initialization-fails-with-an-incorrect-password
Author
Owner

@magein commented on GitHub (Feb 21, 2024):

重置后添加 cohere中的key还是出现403的错误
添加key失败

@magein commented on GitHub (Feb 21, 2024): 重置后添加 cohere中的key还是出现403的错误 ![添加key失败](https://github.com/langgenius/dify/assets/16146901/daff4d53-2947-4c80-90e7-25c90718a87c)
Author
Owner

@zhanaali commented on GitHub (Feb 22, 2024):

貌似是国内ip被拦截了

@zhanaali commented on GitHub (Feb 22, 2024): 貌似是国内ip被拦截了
Author
Owner

@magein commented on GitHub (Feb 22, 2024):

用了代理了一直403

@magein commented on GitHub (Feb 22, 2024): 用了代理了一直403
Author
Owner

@mylxsw commented on GitHub (Feb 28, 2024):

我这边也遇到了同样的问题

@mylxsw commented on GitHub (Feb 28, 2024): 我这边也遇到了同样的问题
Author
Owner

@magein commented on GitHub (Feb 28, 2024):

国内ip的问题。被封禁了

---Original---
From: @.>
Date: Thu, Feb 29, 2024 01:53 AM
To: @.
>;
Cc: @.@.>;
Subject: Re: [langgenius/dify] failed to add cohere key (Issue #2506)

我这边也遇到了同样的问题


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: @.***>

@magein commented on GitHub (Feb 28, 2024): 国内ip的问题。被封禁了 ---Original--- From: ***@***.***&gt; Date: Thu, Feb 29, 2024 01:53 AM To: ***@***.***&gt;; Cc: ***@***.******@***.***&gt;; Subject: Re: [langgenius/dify] failed to add cohere key (Issue #2506) 我这边也遇到了同样的问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: ***@***.***&gt;
Author
Owner

@m5314 commented on GitHub (Mar 6, 2024):

国内ip的问题。被封禁了

---Original--- From: @.> Date: Thu, Feb 29, 2024 01:53 AM To: @.>; Cc: @.@.>; Subject: Re: [langgenius/dify] failed to add cohere key (Issue #2506) 我这边也遇到了同样的问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

你好,我也遇到这个问题,请问有解决办法吗?

@m5314 commented on GitHub (Mar 6, 2024): > 国内ip的问题。被封禁了 > […](#) > ---Original--- From: ***@***.***&gt; Date: Thu, Feb 29, 2024 01:53 AM To: ***@***.***&gt;; Cc: ***@***.******@***.***&gt;; Subject: Re: [langgenius/dify] failed to add cohere key (Issue #2506) 我这边也遇到了同样的问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: ***@***.***&gt; 你好,我也遇到这个问题,请问有解决办法吗?
Author
Owner

@jay-jjwu commented on GitHub (Jun 27, 2024):

我也遇到了相同的问题,用了代理也不行,有人解决了吗?用Postman测试是可以访问cohere的接口的。

@jay-jjwu commented on GitHub (Jun 27, 2024): 我也遇到了相同的问题,用了代理也不行,有人解决了吗?用Postman测试是可以访问cohere的接口的。
Author
Owner

@jay-jjwu commented on GitHub (Jun 28, 2024):

在dify-api容器中,添加代理服务器,可以解决

@jay-jjwu commented on GitHub (Jun 28, 2024): 在dify-api容器中,添加代理服务器,可以解决
Author
Owner

@marioalexandreantunes commented on GitHub (Nov 2, 2024):

Got same error in v0.10.1

  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 42, in invoke
    return self._invoke(model, credentials, query, docs, score_threshold, top_n, user)
  File "/app/api/core/model_runtime/model_providers/cohere/rerank/rerank.py", line 51, in _invoke
    response = client.rerank(
  File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1259, in rerank
    raise ApiError(status_code=_response.status_code, body=_response.text)
cohere.core.api_error.ApiError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 496, in _retriever
    documents = RetrievalService.retrieve(
  File "/app/api/core/rag/datasource/retrieval_service.py", line 110, in retrieve
    all_documents = data_post_processor.invoke(
  File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke
    documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user)
  File "/app/api/core/rag/rerank/rerank_model.py", line 45, in run
    rerank_result = self.rerank_model_instance.invoke_rerank(
  File "/app/api/core/model_manager.py", line 226, in invoke_rerank
    return self._round_robin_invoke(
  File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke
    return function(*args, **kwargs)
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 44, in invoke
    raise self._transform_invoke_error(e)
core.model_runtime.errors.invoke.InvokeBadRequestError: [cohere] Bad Request Error, status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden
/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py:1107: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6>
  if is_not_primary_key(identitykey[1]):
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2024-11-02 10:48:36,397.397 INFO [Thread-13 (_generate_worker)] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden"
2024-11-02 10:48:36,399.399 ERROR [Thread-13 (_generate_worker)] [knowledge_retrieval_node.py:65] - Error when running knowledge retrieval node
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1257, in rerank
    _response_json = _response.json()
  File "/app/api/.venv/lib/python3.10/site-packages/httpx/_models.py", line 766, in json
    return jsonlib.loads(self.content, **kwargs)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 42, in invoke
    return self._invoke(model, credentials, query, docs, score_threshold, top_n, user)
  File "/app/api/core/model_runtime/model_providers/cohere/rerank/rerank.py", line 51, in _invoke
    response = client.rerank(
  File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1259, in rerank
    raise ApiError(status_code=_response.status_code, body=_response.text)
cohere.core.api_error.ApiError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py", line 58, in _run
    results = self._fetch_dataset_retriever(node_data=self.node_data, query=query)
  File "/app/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py", line 155, in _fetch_dataset_retriever
    all_documents = dataset_retrieval.multiple_retrieve(
  File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 390, in multiple_retrieve
    all_documents = data_post_processor.invoke(
  File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke
    documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user)
  File "/app/api/core/rag/rerank/rerank_model.py", line 45, in run
    rerank_result = self.rerank_model_instance.invoke_rerank(
  File "/app/api/core/model_manager.py", line 226, in invoke_rerank
    return self._round_robin_invoke(
  File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke
    return function(*args, **kwargs)
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 44, in invoke
    raise self._transform_invoke_error(e)
core.model_runtime.errors.invoke.InvokeBadRequestError: [cohere] Bad Request Error, status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden
/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py:1312: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6>
  fn = getattr(self, f"_memoized_method_{key}")
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2024-11-02 10:54:17,113.113 INFO [Dummy-22] [_client.py:1038] - HTTP Request: POST https://api.cohere.ai/v1/rerank "HTTP/1.1 403 Forbidden"
/usr/local/lib/python3.10/json/decoder.py:353: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6>
  obj, end = self.scan_once(s, idx)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2024-11-02 10:55:43,784.784 INFO [Dummy-23] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank"HTTP/1.1 403 Forbidden"
/app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py:1340: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6>
  for key, getter in populators["quick"]:
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2024-11-02 10:55:51,036.036 INFO [Dummy-24] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden"

Deleted the Account a trying to add again and now i got :

2024-11-02 11:01:40,144.144 INFO [Dummy-25] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden"
@marioalexandreantunes commented on GitHub (Nov 2, 2024): Got same error in v0.10.1 ``` File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 42, in invoke return self._invoke(model, credentials, query, docs, score_threshold, top_n, user) File "/app/api/core/model_runtime/model_providers/cohere/rerank/rerank.py", line 51, in _invoke response = client.rerank( File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1259, in rerank raise ApiError(status_code=_response.status_code, body=_response.text) cohere.core.api_error.ApiError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/local/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 496, in _retriever documents = RetrievalService.retrieve( File "/app/api/core/rag/datasource/retrieval_service.py", line 110, in retrieve all_documents = data_post_processor.invoke( File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user) File "/app/api/core/rag/rerank/rerank_model.py", line 45, in run rerank_result = self.rerank_model_instance.invoke_rerank( File "/app/api/core/model_manager.py", line 226, in invoke_rerank return self._round_robin_invoke( File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke return function(*args, **kwargs) File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 44, in invoke raise self._transform_invoke_error(e) core.model_runtime.errors.invoke.InvokeBadRequestError: [cohere] Bad Request Error, status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden /app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py:1107: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6> if is_not_primary_key(identitykey[1]): ResourceWarning: Enable tracemalloc to get the object allocation traceback 2024-11-02 10:48:36,397.397 INFO [Thread-13 (_generate_worker)] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden" 2024-11-02 10:48:36,399.399 ERROR [Thread-13 (_generate_worker)] [knowledge_retrieval_node.py:65] - Error when running knowledge retrieval node Traceback (most recent call last): File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1257, in rerank _response_json = _response.json() File "/app/api/.venv/lib/python3.10/site-packages/httpx/_models.py", line 766, in json return jsonlib.loads(self.content, **kwargs) File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 42, in invoke return self._invoke(model, credentials, query, docs, score_threshold, top_n, user) File "/app/api/core/model_runtime/model_providers/cohere/rerank/rerank.py", line 51, in _invoke response = client.rerank( File "/app/api/.venv/lib/python3.10/site-packages/cohere/base_client.py", line 1259, in rerank raise ApiError(status_code=_response.status_code, body=_response.text) cohere.core.api_error.ApiError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py", line 58, in _run results = self._fetch_dataset_retriever(node_data=self.node_data, query=query) File "/app/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py", line 155, in _fetch_dataset_retriever all_documents = dataset_retrieval.multiple_retrieve( File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 390, in multiple_retrieve all_documents = data_post_processor.invoke( File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user) File "/app/api/core/rag/rerank/rerank_model.py", line 45, in run rerank_result = self.rerank_model_instance.invoke_rerank( File "/app/api/core/model_manager.py", line 226, in invoke_rerank return self._round_robin_invoke( File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke return function(*args, **kwargs) File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 44, in invoke raise self._transform_invoke_error(e) core.model_runtime.errors.invoke.InvokeBadRequestError: [cohere] Bad Request Error, status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden /app/api/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py:1312: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6> fn = getattr(self, f"_memoized_method_{key}") ResourceWarning: Enable tracemalloc to get the object allocation traceback 2024-11-02 10:54:17,113.113 INFO [Dummy-22] [_client.py:1038] - HTTP Request: POST https://api.cohere.ai/v1/rerank "HTTP/1.1 403 Forbidden" /usr/local/lib/python3.10/json/decoder.py:353: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6> obj, end = self.scan_once(s, idx) ResourceWarning: Enable tracemalloc to get the object allocation traceback 2024-11-02 10:55:43,784.784 INFO [Dummy-23] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank"HTTP/1.1 403 Forbidden" /app/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py:1340: ResourceWarning: unclosed <socket object, fd=16, family=2, type=1, proto=6> for key, getter in populators["quick"]: ResourceWarning: Enable tracemalloc to get the object allocation traceback 2024-11-02 10:55:51,036.036 INFO [Dummy-24] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden" ``` Deleted the Account a trying to add again and now i got : ``` 2024-11-02 11:01:40,144.144 INFO [Dummy-25] [_client.py:1038] - HTTP Request: POST https://api.cohere.com/v2/rerank "HTTP/1.1 403 Forbidden" ```
Author
Owner

@RamyHuang commented on GitHub (Nov 26, 2024):

有可以解决的么,我这边遇到了同样的问题

@RamyHuang commented on GitHub (Nov 26, 2024): 有可以解决的么,我这边遇到了同样的问题
Author
Owner

@RamyHuang commented on GitHub (Nov 26, 2024):

image
一直报403异常。我在api了加了http_proxy的代理,还是不行

@RamyHuang commented on GitHub (Nov 26, 2024): ![image](https://github.com/user-attachments/assets/178ece39-4b52-486d-ae6c-ff8b9075c733) 一直报403异常。我在api了加了http_proxy的代理,还是不行
Author
Owner

@159753Fetter commented on GitHub (Dec 9, 2024):

在dify-api容器中,添加代理服务器,可以解决

您好,请问具体怎么加呢?

@159753Fetter commented on GitHub (Dec 9, 2024): > 在dify-api容器中,添加代理服务器,可以解决 您好,请问具体怎么加呢?
Author
Owner

@badspider7 commented on GitHub (May 26, 2025):

添加openRouter 插件也报403

@badspider7 commented on GitHub (May 26, 2025): 添加openRouter 插件也报403
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1077