litellm - ✅(Solved) Fix [Bug]: always_include_stream_usage is missing from router options [1 pull requests, 3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23343Fetched 2026-04-08 00:37:21
View on GitHub
Comments
3
Participants
2
Timeline
13
Reactions
1
Author
Participants
Timeline (top)
commented ×3cross-referenced ×2labeled ×2mentioned ×2

Fix Action

Fixed

PR fix notes

PR #23359: feat(router): add always_include_stream_usage to UpdateRouterConfig and router.update_settings

Description (problem / solution / changelog)

Problem

always_include_stream_usage is documented as a general_settings option but is absent from the Router Settings UI (UpdateRouterConfig / router.update_settings()). Users cannot configure it from the Admin UI without editing the config file (closes #23343).

Changes

FileChange
litellm/types/router.pyAdd always_include_stream_usage: Optional[bool] to UpdateRouterConfig
litellm/router.pyAdd 'always_include_stream_usage' to _allowed_settings in update_settings()
litellm/proxy/common_request_processing.pyAlso check llm_router.always_include_stream_usage alongside general_settings, so the router-level flag activates the stream_options injection

Closes #23343

Changed files

  • litellm/model_prices_and_context_window_backup.json (modified, +30/-0)
  • litellm/proxy/common_request_processing.py (modified, +5/-1)
  • litellm/router.py (modified, +1/-0)
  • litellm/types/router.py (modified, +2/-0)
  • model_prices_and_context_window.json (modified, +30/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

As described by https://docs.litellm.ai/docs/completion/usage#proxy-always-include-streaming-usage. However when following the steps, the setting appears to be missing...

I may be mis-interpreting the docs or going to the wrong UI?

<img width="2469" height="1467" alt="Image" src="https://github.com/user-attachments/assets/9d6dec53-a428-4830-94e7-db5b33003ac3" />

Steps to Reproduce

Navigating to Go to Settings > Router Settings > General should include always_include_stream_usage.

Falling back to editing config instead.

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v.1.12.0

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To fix the missing always_include_stream_usage setting, you can try the following steps:

  • Edit the configuration file directly to add the missing setting.
  • Update the UI to reflect the changes.

Here's an example of how you can add the setting to the configuration file:

# config.yml
router_settings:
  general:
    always_include_stream_usage: true

Alternatively, you can use the LiteLLM API to update the setting programmatically:

import requests

# Replace with your API endpoint and credentials
api_endpoint = "https://your-litellm-instance.com/api"
api_token = "your-api-token"

# Update the router settings
response = requests.patch(
    f"{api_endpoint}/router/settings",
    headers={"Authorization": f"Bearer {api_token}"},
    json={"always_include_stream_usage": True}
)

# Check if the update was successful
if response.status_code == 200:
    print("Setting updated successfully")
else:
    print("Failed to update setting")

Verification

To verify that the fix worked, navigate to the Settings > Router Settings > General page and check if the always_include_stream_usage setting is now visible and enabled.

Extra Tips

  • Make sure to restart the LiteLLM service after updating the configuration file for the changes to take effect.
  • If you're using a load balancer or proxy, ensure that it's configured to forward the always_include_stream_usage setting to the LiteLLM instance.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING