Stream chunks

Every chunk on the wire is on the allowlist below. The JavaScript and Python SDKs reject any chunk not on this list as a ProtocolError.

Request assertions

Both SDKs check the response headers before parsing the first byte. The server asserts:

HeaderValue
content-typetext/event-stream
x-vercel-ai-ui-message-streamv1
x-accel-bufferingno
x-vedika-turn-idThe server-assigned turn id.
x-vedika-thread-idThe thread id (resume only).

The chunk allowlist

Reading the stream

Concatenate every text-delta for a given id. The id is stable between text-start and text-end. A turn emits finish, abort, or error as its terminal chunk. Only one of those three can arrive on a given turn.

Custom Vedika chunks

Three data-vedika-* chunks carry domain-specific payloads. Always treat data as an opaque JSON object until the SDK validates it.