> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Trait Streaming Codec

> Per-provider streaming codec used with `crate::api::llm::llm_stream_call_execute`.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi`.

<pre />

Per-provider streaming codec used with [`crate::api::llm::llm_stream_call_execute`](/reference/api/rust-library-reference/nemo-relay/api/llm/fn-llm-stream-call-execute).

`collector()` and `finalizer()` produce owned closures that share the codec's internal accumulation state. Implementations typically wrap that state in `Arc<Mutex<...>>` so each `&self`-produced closure captures a clone of the handle.

[`LlmFinalizerFn`](/reference/api/rust-library-reference/nemo-relay/api/runtime/callbacks/type-llmfinalizerfn) is `FnOnce`, so a [`StreamingCodec`](/reference/api/rust-library-reference/nemo-relay/codec/streaming/trait-streamingcodec) instance is single-use: callers construct a fresh instance per managed-lifecycle call and discard it after the stream completes.

## Required Methods

#### `collector`

<pre />

Returns a closure that consumes one decoded provider event per call.

#### `finalizer`

<pre />

Returns a closure that, when called once at end of stream, produces the assembled response payload in the shape the matching [`crate::codec::traits::LlmResponseCodec`](/reference/api/rust-library-reference/nemo-relay/codec/traits/trait-llmresponsecodec) can decode.

## Implementors

### `impl StreamingCodec for AnthropicMessagesStreamingCodec`

<pre />

### `impl StreamingCodec for OpenAIChatStreamingCodec`

<pre />

### `impl StreamingCodec for OpenAIResponsesStreamingCodec`

<pre />