mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[PR #1798] Fix/OpenAI streaming usage #2094
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?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/1798
Author: @Arui1122
Created: 10/1/2025
Status: 🔄 Open
Base:
main← Head:fix/openai-streaming-usage📝 Commits (2)
1eea78efix(openai_api_compatible): include usage in streaming responses232ca01chore: bump version to 0.0.23📊 Changes
2 files changed (+126 additions, -2 deletions)
View changed files
📝
models/openai_api_compatible/manifest.yaml(+1 -1)📝
models/openai_api_compatible/models/llm/llm.py(+125 -1)📄 Description
Related Issues or Context
Fixes token counting issue for OpenAI-compatible APIs in streaming mode.
OpenAI-compatible providers (like LiteLLM) do not return token usage by default in streaming responses. This causes Dify to fall back to token estimation instead of using the actual count from the provider.
This PR contains Changes to Non-Plugin
This PR contains Changes to Non-LLM Models Plugin
This PR contains Changes to LLM Models Plugin
My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
My Changes Affect Structured Output Format (JSON, XML, etc.)
My Changes Affect Token Consumption Metrics
My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
Other Changes (Add New Models, Fix Model Parameters etc.)
Version Control
VersionField, Not in Meta Section)Dify Plugin SDK Version
dify_plugin>=0.3.0,<0.5.0is in requirements.txt (SDK docs)Environment Verification
Local Deployment Environment
SaaS Environment
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.