Function: encodeGatewayStream()
encodeGatewayStream(
protocol,model,source):ReadableStream<Uint8Array<ArrayBufferLike>>
Encode AI SDK events as the requested protocol while preserving backpressure.
Parameters
Section titled “Parameters”protocol
Section titled “protocol”"openai-responses" | "openai-chat" | "anthropic-messages" | "openai-embeddings"
string
source
Section titled “source”AsyncIterable<TextStreamPart<ToolSet>>
Returns
Section titled “Returns”ReadableStream<Uint8Array<ArrayBufferLike>>