docs: note that LITELLM_ENFORCE_STREAMED_USAGE requires a server restart

Add a comment in code and a note in docs clarifying that the env var is
cached at module load time and changing it at runtime has no effect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mrigasiyer 2026-03-10 14:21:21 -07:00
parent be6d8973a9
commit e7d3615fee
2 changed files with 4 additions and 1 deletions

View file

@ -70,6 +70,8 @@ Or set the environment variable (no config file change needed):
LITELLM_ENFORCE_STREAMED_USAGE=true
```
> **Note:** This value is read once at server startup. Changing it at runtime has no effect — a server restart is required.
Alternatively, configure it through the UI:
1. Navigate to the LiteLLM Proxy UI

View file

@ -53,7 +53,8 @@ StreamChunkSerializer = Callable[[Any], str]
# Type alias for streaming error serializer (ProxyException -> wire format)
StreamErrorSerializer = Callable[[ProxyException], str]
# Cached at module load time to avoid repeated env var lookups on every request
# Cached at module load time to avoid repeated env var lookups on every request.
# NOTE: changing this env var at runtime has no effect; a server restart is required.
_ENFORCE_STREAMED_USAGE = (
os.environ.get("LITELLM_ENFORCE_STREAMED_USAGE", "false").lower() == "true"
)