Stream
NAME
LLM::Chat::Backend::Response::OpenRouter::Stream - Streaming variant of Response::OpenRouter
SYNOPSIS
use LLM::Chat::Backend::Response::OpenRouter::Stream;
# Constructed by L<LLM::Chat::Backend::OpenRouter>'s
# C<chat-completion-stream> path. Behaves like
# C<LLM::Chat::Backend::Response::Stream> (accumulates emitted
# tokens into C<.latest>) and additionally carries
# C<.cost> / C<.generation-id> / C<.provider-name> / C<.is-byok>
# from the L<...::OpenRouter::Augment> role.
DESCRIPTION
Subclass of LLM::Chat::Backend::Response::Stream that consumes
the LLM::Chat::Backend::Response::OpenRouter::Augment role to
add OR-specific usage + routing fields. The streaming
._emit / ._done behaviour is inherited unchanged from the
base stream class.
OR's terminal usage frame (sent after finish_reason: stop, before
[DONE]) is lifted by the backend via
_set-or-usage on this same instance ā so cost / generation-id /
provider-name become readable by the time the supply done-signal
fires.