> 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.

# Struct Anthropic Messages Streaming Codec

> Streaming counterpart to `AnthropicMessagesCodec`.

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

```rust
pub struct AnthropicMessagesStreamingCodec { /* private fields */ }
```

Streaming counterpart to [`AnthropicMessagesCodec`](/reference/api/rust-library-reference/nemo-relay/codec/anthropic/struct-anthropicmessagescodec).

Replays the Anthropic Messages SSE event sequence into the same JSON shape Anthropic returns for a non-streaming request (`{id, type, role, model, content, stop_reason, stop_sequence, usage}`). Once finalized, the assembled JSON can be fed back through [`AnthropicMessagesCodec::decode_response`](/reference/api/rust-library-reference/nemo-relay/codec/anthropic/struct-anthropicmessagescodec) to produce an [`AnnotatedLlmResponse`](/reference/api/rust-library-reference/nemo-relay/codec/response/struct-annotatedllmresponse) - meaning streaming and non-streaming Anthropic requests converge on the same observability output.

Internal state lives behind `Arc<Mutex<...>>` so the `&self`-produced collector and finalizer closures share access. Each instance is single-use because [`LlmFinalizerFn`](/reference/api/rust-library-reference/nemo-relay/api/runtime/callbacks/type-llmfinalizerfn) consumes the finalize step.

## Implementations

### `impl AnthropicMessagesStreamingCodec`

<pre />

#### `new`

<pre />

Creates a fresh streaming codec with empty accumulator state.

## Trait Implementations

### `impl Default for AnthropicMessagesStreamingCodec`

<pre />

#### `default`

<pre />

### `impl StreamingCodec for AnthropicMessagesStreamingCodec`

<pre />

#### `collector`

<pre />

#### `finalizer`

<pre />