Skip to content

fix(deepseek): enable token usage in streaming responses#809

Open
wucm667 wants to merge 1 commit intocloudwego:mainfrom
wucm667:fix/deepseek-token-usage
Open

fix(deepseek): enable token usage in streaming responses#809
wucm667 wants to merge 1 commit intocloudwego:mainfrom
wucm667:fix/deepseek-token-usage

Conversation

@wucm667
Copy link
Copy Markdown

@wucm667 wucm667 commented Apr 28, 2026

Fixes #738

Problem

The generateStreamRequest function in components/model/deepseek/deepseek.go hardcodes StreamOptions.IncludeUsage to false, which prevents users from receiving token usage information in streaming responses.

Solution

Change IncludeUsage from false to true so that streaming responses include token usage data.

Changes

  • Modified components/model/deepseek/deepseek.go line 522: IncludeUsage: falseIncludeUsage: true

This is a minimal, single-line change that enables the DeepSeek API to return token usage statistics in streaming mode without affecting any other functionality.

Change StreamOptions.IncludeUsage from false to true so that
streaming responses include token usage data.

Fixes cloudwego#738
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

deepseek.go的generateStreamRequest该方法不支持返回token用量

1 participant