OpenAI Compatible Dify App Plugin Generates Incorrect API Endpoint URLs #350

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

Originally created by @lukefan on GitHub (Jun 6, 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 search for existing issues, 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.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • Plugin Version: 0.0.5

Steps to Reproduce:

  1. Set local deployment URLs in .env file (e.g., APP_WEB_URL=http://192.168.0.66:3330).
  2. Use the OpenAI Compatible Dify App plugin to wrap a Dify App as an OpenAI compatible API.
  3. Observe the generated API endpoint URL.
  4. Try to use the generated URL or manually corrected URLs in Cherry Studio.

✔️ Expected Behavior

The plugin should generate API endpoint URLs based on the configured APP_WEB_URL in the .env file, and these URLs should work when used in applications like Cherry Studio.

Actual Behavior

  1. The generated URL points to localhost instead of the configured IP address (e.g., http://localhost/e/u6p4nh568i323flk}/chat/completions).
  2. The generated URL contains an extra '}' character.
  3. Even after manually correcting the URL to use the correct IP and removing invalid characters, Cherry Studio still reports errors (e.g., "Invalid URL" or "Check your spelling").
Originally created by @lukefan on GitHub (Jun 6, 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 [search for existing issues](https://github.com/langgenius/dify/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.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - Plugin Version: 0.0.5 **Steps to Reproduce:** 1. Set local deployment URLs in .env file (e.g., APP_WEB_URL=http://192.168.0.66:3330). 2. Use the OpenAI Compatible Dify App plugin to wrap a Dify App as an OpenAI compatible API. 3. Observe the generated API endpoint URL. 4. Try to use the generated URL or manually corrected URLs in Cherry Studio. ### ✔️ Expected Behavior The plugin should generate API endpoint URLs based on the configured APP_WEB_URL in the .env file, and these URLs should work when used in applications like Cherry Studio. ### ❌ Actual Behavior 1. The generated URL points to localhost instead of the configured IP address (e.g., http://localhost/e/u6p4nh568i323flk}/chat/completions). 2. The generated URL contains an extra '}' character. 3. Even after manually correcting the URL to use the correct IP and removing invalid characters, Cherry Studio still reports errors (e.g., "Invalid URL" or "Check your spelling").
yindo closed this issue 2026-02-16 10:19:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 6, 2025):

I couldn't find any existing issues or documentation about this specific URL generation problem, but based on the code, the plugin uses a template (ENDPOINT_URL_TEMPLATE) and a config value (PLUGIN_DAEMON_URL) to build the endpoint URLs. By default, both are set to use localhost, which explains why your generated URLs point there instead of your configured IP. If these values aren't explicitly overridden in your environment or Docker setup, the defaults will be used, regardless of your APP_WEB_URL setting.

To fix this, make sure you set both PLUGIN_DAEMON_URL and ENDPOINT_URL_TEMPLATE in your .env file to use your desired IP address, for example:

PLUGIN_DAEMON_URL=http://192.168.0.66:3330
ENDPOINT_URL_TEMPLATE=http://192.168.0.66:3330/e/{hook_id}

Restart your containers after making these changes. This should ensure the plugin generates URLs with the correct IP.

The extra } in the URL suggests a formatting bug—double-check for typos in your config and ensure the template string is exactly {hook_id}. If the problem persists after correcting the config, there may be a bug in how the template is rendered in the code (see implementation).

If Cherry Studio still reports "Invalid URL" after these changes, it could be due to a malformed URL or a missing route on your Dify instance. Double-check the full endpoint path and ensure your app is accessible at the configured address.

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 (Jun 6, 2025): <!-- Answer --> I couldn't find any existing issues or documentation about this specific URL generation problem, but based on the code, the plugin uses a template (`ENDPOINT_URL_TEMPLATE`) and a config value (`PLUGIN_DAEMON_URL`) to build the endpoint URLs. By default, both are set to use `localhost`, which explains why your generated URLs point there instead of your configured IP. If these values aren't explicitly overridden in your environment or Docker setup, the defaults will be used, regardless of your `APP_WEB_URL` setting. To fix this, make sure you set both `PLUGIN_DAEMON_URL` and `ENDPOINT_URL_TEMPLATE` in your `.env` file to use your desired IP address, for example: ``` PLUGIN_DAEMON_URL=http://192.168.0.66:3330 ENDPOINT_URL_TEMPLATE=http://192.168.0.66:3330/e/{hook_id} ``` Restart your containers after making these changes. This should ensure the plugin generates URLs with the correct IP. The extra `}` in the URL suggests a formatting bug—double-check for typos in your config and ensure the template string is exactly `{hook_id}`. If the problem persists after correcting the config, there may be a bug in how the template is rendered in the code ([see implementation](https://github.com/langgenius/dify/blob/930c4cb60904f29b21f0cf5abf8da8063ed4ec7a/api/core/plugin/entities/endpoint.py)). If Cherry Studio still reports "Invalid URL" after these changes, it could be due to a malformed URL or a missing route on your Dify instance. Double-check the full endpoint path and ensure your app is accessible at the configured address. <!-- 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/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2a3792ab-87ed-496e-8078-e12df96148e9?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/issues/20774)
Author
Owner

@lukefan commented on GitHub (Jun 6, 2025):

DB_PLUGIN_DATABASE=dify_plugin
EXPOSE_PLUGIN_DAEMON_PORT=5002
PLUGIN_DAEMON_PORT=5002
PLUGIN_DAEMON_KEY=lYkiYYT6owG+71oLerGzA7GXCgOT++6ovaezWAjpCjf+Sjc3ZtU+qUEi
PLUGIN_DAEMON_URL=http://plugin_daemon:5002
PLUGIN_MAX_PACKAGE_SIZE=52428800
PLUGIN_PPROF_ENABLED=false

PLUGIN_DEBUGGING_HOST=0.0.0.0
PLUGIN_DEBUGGING_PORT=5003
EXPOSE_PLUGIN_DEBUGGING_HOST=localhost
EXPOSE_PLUGIN_DEBUGGING_PORT=5003

PLUGIN_DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691iy+kGDv2Jvy0/eAh8Y1
PLUGIN_DIFY_INNER_API_URL=http://api:5001

ENDPOINT_URL_TEMPLATE=http://localhost/e/{hook_id}

I’ve tested the plugin-related configurations, and there are quite a few settings involved. When I tried changing the port from 5002 to 3330, the entire system stopped working—models couldn’t connect at all. Additionally, the original port (5002) wasn’t exposed externally, so it couldn’t be accessed from outside the local environment.
Even when I only modified the two settings you provided (without changing other configurations), the issue persisted: all models became unreachable. The system behaves as if the configuration changes disrupted the model connectivity, regardless of whether the port is adjusted or only partial settings are updated.

When accessing the URL http://192.168.0.66:3330/e/u6p4nh568i323flk/chat/completions/ in the browser, the following error is returned:
"Failed to dispatch endpoint request: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually, please check your spelling and try again."

@lukefan commented on GitHub (Jun 6, 2025): DB_PLUGIN_DATABASE=dify_plugin EXPOSE_PLUGIN_DAEMON_PORT=5002 PLUGIN_DAEMON_PORT=5002 PLUGIN_DAEMON_KEY=lYkiYYT6owG+71oLerGzA7GXCgOT++6ovaezWAjpCjf+Sjc3ZtU+qUEi PLUGIN_DAEMON_URL=http://plugin_daemon:5002 PLUGIN_MAX_PACKAGE_SIZE=52428800 PLUGIN_PPROF_ENABLED=false PLUGIN_DEBUGGING_HOST=0.0.0.0 PLUGIN_DEBUGGING_PORT=5003 EXPOSE_PLUGIN_DEBUGGING_HOST=localhost EXPOSE_PLUGIN_DEBUGGING_PORT=5003 PLUGIN_DIFY_INNER_API_KEY=QaHbTe77CtuXmsfyhR7+vRjI/+XbV1AaFy691iy+kGDv2Jvy0/eAh8Y1 PLUGIN_DIFY_INNER_API_URL=http://api:5001 ENDPOINT_URL_TEMPLATE=http://localhost/e/{hook_id} I’ve tested the plugin-related configurations, and there are quite a few settings involved. When I tried changing the port from 5002 to 3330, the entire system stopped working—models couldn’t connect at all. Additionally, the original port (5002) wasn’t exposed externally, so it couldn’t be accessed from outside the local environment. Even when I only modified the two settings you provided (without changing other configurations), the issue persisted: all models became unreachable. The system behaves as if the configuration changes disrupted the model connectivity, regardless of whether the port is adjusted or only partial settings are updated. When accessing the URL http://192.168.0.66:3330/e/u6p4nh568i323flk/chat/completions/ in the browser, the following error is returned: "Failed to dispatch endpoint request: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually, please check your spelling and try again."
Author
Owner

@sunlight002 commented on GitHub (Jun 21, 2025):

+1

@sunlight002 commented on GitHub (Jun 21, 2025): +1
Author
Owner

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

Hi, @lukefan. 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 the OpenAI Compatible Dify App plugin (v0.0.5) generates incorrect API URLs defaulting to localhost with an extra '}' character, causing "Invalid URL" errors.
  • The plugin uses default localhost settings for PLUGIN_DAEMON_URL and ENDPOINT_URL_TEMPLATE unless overridden in the .env file.
  • You tried adjusting these environment variables but then faced model connectivity failures and 404 errors, indicating configuration changes disrupt the system.
  • I noted a possible formatting bug causing the extra '}' character.
  • Another user, sunlight002, has shown support for 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, this issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 20, 2025): Hi, @lukefan. 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 the OpenAI Compatible Dify App plugin (v0.0.5) generates incorrect API URLs defaulting to localhost with an extra '}' character, causing "Invalid URL" errors. - The plugin uses default localhost settings for `PLUGIN_DAEMON_URL` and `ENDPOINT_URL_TEMPLATE` unless overridden in the `.env` file. - You tried adjusting these environment variables but then faced model connectivity failures and 404 errors, indicating configuration changes disrupt the system. - I noted a possible formatting bug causing the extra '}' character. - Another user, sunlight002, has shown support for 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, this issue will be automatically closed. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#350