LocalAI plugin: Missing /v1 prefix in Rerank endpoint causes 404 error #391

Closed
opened 2026-02-16 10:19:16 -05:00 by yindo · 3 comments
Owner

Originally created by @gakugaku on GitHub (Jun 22, 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.4.3

Plugin version

0.0.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In a Dify 1.1.3 + LocalAI 0.0.3 setup, registering a LocalAI Rerank model fails because requests are sent to .../rerank instead of .../v1/rerank, resulting in a 404 CredentialsValidateFailedError.

  1. In the Dify admin UI, open Model Provider → LocalAI.
  2. Select Rerank and enter a model name such as bge-reranker-v2-m3.
  3. Set Server url to http://localhost:8080 (sample host/port).
  4. Click Save → validation fails with:
    CredentialsValidateFailedError: 404 Client Error: Not Found for url:
    http://localhost:8080/rerank
    

Expected Behavior

The request is sent to http://localhost:8080/v1/rerank and returns HTTP 200.

Actual Behavior

The request is sent to http://localhost:8080/rerank and LocalAI returns HTTP 404.

Root Cause

models/localai/models/rerank/rerank.py builds the URL as:

url = f"{server_url}/rerank"

Unless the user manually appends /v1 to Server url, the request lacks the version prefix.

Related Code Comparison

Feature LocalAI docs (endpoint example) Plugin file (line) /v1 added in code?
Text generation (LLM) /v1/completions llm.py#L346
Text-to-Audio /v1/audio/speech speech2text.py#L34
Reranker /v1/rerank rerank.py#L63
Embeddings /embeddings text_embedding.py#L67 — (spec expects none)

Embeddings intentionally omits /v1, matching the LocalAI spec.

Proposed Fix

Update rerank.py to align with the other plugins:

https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/rerank/rerank.py#L63

- str(URL(url) / "rerank")
+ str(URL(url) / "v1/rerank")

✔️ Error log

No response

Originally created by @gakugaku on GitHub (Jun 22, 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.4.3 ### Plugin version 0.0.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce In a Dify 1.1.3 + LocalAI 0.0.3 setup, registering a LocalAI Rerank model fails because requests are sent to `.../rerank` instead of `.../v1/rerank`, resulting in a 404 `CredentialsValidateFailedError`. 1. In the Dify admin UI, open Model Provider → LocalAI. 2. Select Rerank and enter a model name such as `bge-reranker-v2-m3`. 3. Set Server url to `http://localhost:8080` (sample host/port). 4. Click Save → validation fails with: ``` CredentialsValidateFailedError: 404 Client Error: Not Found for url: http://localhost:8080/rerank ``` #### Expected Behavior The request is sent to `http://localhost:8080/v1/rerank` and returns HTTP 200. #### Actual Behavior The request is sent to `http://localhost:8080/rerank` and LocalAI returns HTTP 404. ### Root Cause `models/localai/models/rerank/rerank.py` builds the URL as: ```python url = f"{server_url}/rerank" ``` Unless the user manually appends `/v1` to Server url, the request lacks the version prefix. ### Related Code Comparison | Feature | LocalAI docs (endpoint example) | Plugin file (line) | `/v1` added in code? | | --------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | | Text generation (LLM) | [`/v1/completions`](https://localai.io/features/text-generation/) | [`llm.py#L346`](https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/llm/llm.py#L346) | ✅ | | Text-to-Audio | [`/v1/audio/speech`](https://localai.io/features/text-to-audio/) | [`speech2text.py#L34`](https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/speech2text/speech2text.py#L34) | ✅ | | Reranker | [`/v1/rerank`](https://localai.io/features/reranker/) | [`rerank.py#L63`](https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/rerank/rerank.py#L63) | ❌ | | Embeddings | [`/embeddings`](https://localai.io/features/embeddings/) | [`text_embedding.py#L67`](https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/text_embedding/text_embedding.py#L67) | — (spec expects none) | Embeddings intentionally omits /v1, matching the LocalAI spec. ### Proposed Fix Update `rerank.py` to align with the other plugins: https://github.com/langgenius/dify-official-plugins/blob/c48f8be6aad263a314d7aedb42406402a78354b7/models/localai/models/rerank/rerank.py#L63 ```diff - str(URL(url) / "rerank") + str(URL(url) / "v1/rerank") ``` ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:19:16 -05:00
yindo closed this issue 2026-02-16 10:19:16 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 18, 2025):

Hi, @gakugaku. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify 1.4.3 with LocalAI plugin 0.0.3, the Rerank endpoint URL is missing the required "/v1" prefix.
  • This causes a 404 error during model registration because the URL is constructed as "{server_url}/rerank" instead of "{server_url}/v1/rerank".
  • The suggested fix is to include the "/v1" prefix in the request URL to avoid validation failures.
  • There have been no further comments or updates on this issue.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.
  • If I don’t hear back within 5 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 18, 2025): Hi, @gakugaku. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify 1.4.3 with LocalAI plugin 0.0.3, the Rerank endpoint URL is missing the required "/v1" prefix. - This causes a 404 error during model registration because the URL is constructed as "{server_url}/rerank" instead of "{server_url}/v1/rerank". - The suggested fix is to include the "/v1" prefix in the request URL to avoid validation failures. - There have been no further comments or updates on this issue. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. - If I don’t hear back within 5 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@gakugaku commented on GitHub (Aug 23, 2025):

https://github.com/langgenius/dify-official-plugins/issues/1142#issuecomment-3197530448

  • Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.

this issue is still relevant with the latest version of the dify-official-plugins repository.

@gakugaku commented on GitHub (Aug 23, 2025): https://github.com/langgenius/dify-official-plugins/issues/1142#issuecomment-3197530448 > * Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. this issue is still relevant with the latest version of the dify-official-plugins repository.
Author
Owner

@dosubot[bot] commented on GitHub (Aug 23, 2025):

@crazywoola The user gakugaku has confirmed that the issue #1142 is still relevant with the latest version of the dify-official-plugins repository and would appreciate your assistance.

@dosubot[bot] commented on GitHub (Aug 23, 2025): @crazywoola The user gakugaku has confirmed that the issue #1142 is still relevant with the latest version of the dify-official-plugins repository and would appreciate your assistance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#391