In this article
Decide separately whether a stream frame contributes to visible text and whether it must survive in protocol state.
A stream event can have no user-visible text while carrying data the next turn needs. In LiteLLM v1.108.19, released on 26 November, the maintainers backported a change that stops the affected OpenRouter streaming path from discarding chunks containing only reasoning_details. The pull request discusses signed and encrypted metadata. It also lists limits: the separate stream_chunk_builder behavior was outside this change, and the /v1/messages output was unchanged.
Track display and transport independently
An SSE filter that only recognises text deltas can accidentally drop tool arguments or model-specific continuation fields. Classify events at the protocol boundary before deciding what to render. Forward recognised metadata in its original order and encoding when the receiving endpoint expects it. The frontend can still keep those fields out of the chat window. Scope storage and retention to the data your integration needs and the applicable provider policy.
Test a second turn, not just the first
Use an approved staging fixture with a metadata-only event between ordinary events, and exercise the parser that production actually uses. Verify that the UI stays unchanged, that the event is forwarded exactly once, and that the client includes required state when building a supported follow-up request. Where metadata is signed, regard the bytes as opaque rather than rewriting them to match a preferred schema. Run the same test on the alternate adapter if your gateway supports one.
Keep expectations specific to the adapter
The patch describes a stream forwarding behavior. A separate aggregator may still drop metadata as it builds a non-streaming message. Treat successful display, preservation through the transport, and successful continuation as three different assertions. Record the selected endpoint, client and gateway version alongside the result. That makes it possible to identify whether a later regression belongs to the provider, the gateway or an application-specific filter.
Design logs for protocol debugging
For everyday monitoring, record the event type, presence of an expected field, and parser outcome. These attributes help you distinguish a missing upstream frame from a frame the client dropped. They can usually be collected without storing the field value. Compare two captures only in a permitted staging environment. A raw trace from a real conversation can contain material that the application deliberately keeps out of its display and logs.
Sources
Related reading
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.