mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[OpenAI-API-compatible] llm stream output is not smooth problem #894
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ran411285752 on GitHub (Dec 22, 2025).
Self Checks
Dify version
V1.10.0
Plugin version
V0.0.27
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Background: I have a vllm model of a fastapi service agent written in python that is compatible with openai format, and the standard output has been manually processed to return 2-3 characters at a time
Problem: After using OpenAI-API-compatible configuration model, streaming output is not smooth. It feels like waiting for a certain amount of characters to accumulate and output at one time. The same interface is configured to CherryStudio or ChatBox without problems. It can be output normally like streaming output of typewriters. I have asked many friends who have similar situations.
Repeat steps:
This problem seriously affected the user experience
✔️ Error log
No response
@dosubot[bot] commented on GitHub (Dec 22, 2025):
Hi @ran411285752! I'm Dosu and I’m helping the dify-official-plugins team.
This streaming delay isn't caused by Dify or its plugins buffering output by character count—there's no 140-character buffer in the code. The most likely causes are buffering in your HTTP server (Gunicorn), Docker networking, or a reverse proxy (like Nginx or Traefik) in your deployment stack. These layers can accumulate data before flushing it to the client, which explains why other clients (like CherryStudio) stream smoothly but Dify (when running in Docker or behind a proxy) does not [source].
Here are some concrete steps and workarounds:
geventand tune worker count, connections, and keep-alive settings for optimal streaming. For example:gunicorn --worker-class gevent --workers 2 --worker-connections 1000 --timeout 120 app:appThis improves concurrency and reduces buffering [source].
proxy_buffering off;for your/v1/chat/completionsroute.stream_mode_delimiterin your Dify OpenAI-compatible model config from\n\nto\n. This has resolved similar streaming issues for other users with FastAPI backends [source].curl --no-bufferor browser dev tools to confirm that it streams as expected outside Dify. If it does, the issue is almost certainly in the deployment stack, not your code.If you share more about your deployment (proxy, server config, Docker setup), I can help you pinpoint where the buffering is happening.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@ran411285752 commented on GitHub (Dec 26, 2025):
After the operation and maintenance engineer checked, it was because nginx did not close the buffer policy. After closing it, it returned to normal.