﻿# LiteLLM restores streamed chat completions for OpenCode Go Messages models

Replay a Messages-shaped stream through the chat client and check terminal events, JSON-mode settings and usage; non-streaming success does not establish bridge parity.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-agent-litellm-opencode-messages-chat-stream-bridge/
Language: en

The November 15 LiteLLM v1.111.0-dev.4 prerelease fixes streaming OpenCode Go models that use the Messages protocol through chat completions. Non-streaming calls could already work while streaming failed. Interoperability acceptance should inspect event shape, structured-output behavior and provider-reported cost together, because a bridge can deliver text correctly while losing another part of the application contract.

## The upstream protocol selects the adapter

Configure a synthetic Go deployment using the affected Messages protocol and a control using the already working path. Send the same harmless request with streaming on and off. Capture which adapter produces the response. A model prefix alone may hide protocol differences, so acceptance should record the resolved configuration rather than assume every Go model exercises the same iterator or error path.

## Text and termination are separate assertions

Replay content, finish and final stream termination through the real client parser. Assert the assembled answer once and a completed request state. A client that receives all text but waits forever for a terminal event remains broken for orchestration. Include an empty valid answer and an upstream error after partial content, keeping partial output marked incomplete instead of manufacturing a normal finish for every exception.

## Preserve structured settings and cost provenance

Use a synthetic JSON-mode schema and distinct provider usage metadata. Inspect the forwarded settings and returned accounting separately from text. The implementation retains the Go-reported cost path, so do not replace it with a guessed local price merely because the response now uses chat chunks. Reconcile the request identity with one spend row and verify structured output still reaches the application’s own validator.

## Cancellation should release the bridged response

Disconnect the synthetic client after a known chunk and observe upstream response closure, then run a second request through the same gateway. This checks cleanup and continued service separately from normal completion. The prerelease fixes a specific bridge; it does not establish every Messages-compatible provider or every frontend adapter. A useful migration record names the protocol, client parser, structured mode and accounting path that were actually validated.

## Sources

- [LiteLLM v1.111.0-dev.4 prerelease notes](https://github.com/BerriAI/litellm/releases/tag/v1.111.0-dev.4)
- [LiteLLM implementation and review #51715](https://github.com/BerriAI/litellm/pull/51715)

## Related reading

- [LiteLLM Proxy: when to operate your own model gateway](/journal/litellm-proxy-guide/)
- [LiteLLM virtual keys: separate access for each application](/journal/litellm-virtual-key-scopes/)
