stream message

This block is part of the anthropic group and was last modified in core v15.0.0.

stream message v15.0.0

Send a prompt to Claude and stream the reply token-by-token to a WebSocket channel as it generates, then return the full text.

In pins 12 + flow
  • flow
    flow
  • connection required
    anthropicconnection
  • memory
    anthropicmemory

    Optional. A memory (from create memory); prior turns are loaded in and this exchange is appended, so the chat continues across runs.

  • prompt required
    value

    The user prompt.

  • system
    value

    Optional system prompt (instructions / persona).

  • attachments
    file

    Optional images/PDFs to send with the prompt. For large documents with an expensive model, run them through preflight document first to cut tokens.

  • model
    value

    Model ID. Defaults to the connection's default model. • Suggestions: claude-opus-4-8 claude-sonnet-4-6 claude-haiku-4-5

  • max tokens
    number

    Max tokens to generate. Defaults to 16000.

  • thinking
    condition

    Enable adaptive extended thinking.

  • cache
    condition

    Cache the system prompt (prompt caching) for cheaper repeated calls.

  • effort
    value

    Reasoning effort: low | medium | high | xhigh | max. • Suggestions: low medium high xhigh max

  • channel
    value

    WebSocket channel to broadcast tokens to (the frontend subscribes to it). Leave empty to stream straight to the calling WebSocket connection instead.

  • event
    value

    Event name for the broadcast frames. Defaults to anthropic_delta.

Out pins 11 + flow
  • flow
    flow
  • connection
    anthropicconnection
  • memory
    anthropicmemory

    The memory, passed through with this turn appended; chain it into the next send message.

  • success
    condition
  • text
    value

    The full reply (also delivered live over the channel/spark).

  • usage
    object

    Token counts plus the call cost: input_tokens, output_tokens, cache_read_input_tokens, cache_creation_input_tokens, cost_usd.

  • stop reason
    value
  • partial
    value
  • errors
    array<value>

    Error codes when the call fails (success=false): config_error, internal_error, model_not_allowed, budget_exceeded, concurrency_limit_exceeded, rate_limited, refused, max_tokens, transport_error.

  • warnings
    array<value>

    Non-fatal notices: cost_unknown.

  • error detail
    value
  • on delta
    execute_function

    Optional: run this function for every streamed chunk. It receives the chunk, its index and the text so far. Keep it light; it runs synchronously per chunk and a heavy callback slows the stream.

stream
live message
streaming chat
typewriter
sse

A typical wiring for stream message: a function trigger starts the flow; value feeds the prompt pin; the function out pin wires to an execute block.

Studio canvas example for the stream message block: typical wiring for stream message.

Version history

Introduced in v15.0.0.


Back to anthropic Return to the main group to view all sub-groups Back to anthropic Return to the group to view all blocks within this group