[PR #23933] [CLOSED] fix: inject stream_options for Anthropic OpenAI-compat endpoint to include usage in SSE #66301

Closed
opened 2026-05-06 12:35:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23933
Author: @pvyswiss
Created: 4/21/2026
Status: Closed

Base: mainHead: fix/inject-stream-options-anthropic


📝 Commits (1)

  • aac5d2c fix: inject stream_options for Anthropic to include usage in SSE stream

📊 Changes

1 file changed (+11 additions, -0 deletions)

View changed files

📝 backend/open_webui/routers/openai.py (+11 -0)

📄 Description

Summary

Fixes #23927 (Ref: #23917 Bug 7)

  • Inject stream_options: {"include_usage": true} for Anthropic streaming requests on the OpenAI-compat path
  • Anthropic only returns usage when explicitly requested
  • setdefault preserves any client-provided value
  • Without this, API scripts and plugins get no usage data for analytics

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23933 **Author:** [@pvyswiss](https://github.com/pvyswiss) **Created:** 4/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/inject-stream-options-anthropic` --- ### 📝 Commits (1) - [`aac5d2c`](https://github.com/open-webui/open-webui/commit/aac5d2c6d5433f370f83b94137a7f225887517ca) fix: inject stream_options for Anthropic to include usage in SSE stream ### 📊 Changes **1 file changed** (+11 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/openai.py` (+11 -0) </details> ### 📄 Description ## Summary Fixes #23927 (Ref: #23917 Bug 7) - Inject `stream_options: {"include_usage": true}` for Anthropic streaming requests on the OpenAI-compat path - Anthropic only returns usage when explicitly requested - `setdefault` preserves any client-provided value - Without this, API scripts and plugins get no usage data for analytics --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 12:35:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#66301