v1
latestOpenAPI 3.1.0Apache-2.02026-07-13153158.0 KBInvoke a function and stream the response (SSE or chunked).
Streaming counterpart of /functions/{id}/invoke. The response shape is selected from the request's Accept header:
- Accept: text/event-stream — Server-Sent Events. Each chunk the guest emits via the wasi:tensor/host.emit-chunk host function is rendered as one event: chunk frame. The stream terminates with an event: done frame on success or an event: error frame on guest failure / deadline-elapsed.
- Otherwise — Content-Type: application/octet-stream, Transfer-Encoding: chunked. Each guest chunk is forwarded verbatim as one HTTP chunk frame, followed by the same terminal event: done / event: error line so clients on either negotiation outcome detect end-of-stream uniformly.
v0.4 wiring (T34)
The route is wired end-to-end through tensor_wasm_wasi_gpu::StreamingContext. Guest emits land on a tokio::sync::mpsc::Receiver<Vec<u8>> the gateway drains into the response body. The cooperative-deadline path (T36) routes a deadline-elapsed signal into a final event: error with {"reason":"deadline_elapsed"} so SSE clients can distinguish it from a generic trap. See docs/STREAMING.md.
Path parameters
Server-assigned function identifier (UUIDv4).
Headers
Tenant scope (u64). Defaults to 0 if absent. Mandatory when the gateway runs with TENSOR_WASM_API_REQUIRE_TENANT=1.
Set to text/event-stream to receive SSE framing. Any other value (or absence) selects the application/octet-stream chunked-transfer branch.
Request body
Arbitrary JSON payload, same shape as the synchronous invoke endpoint. The v0.x executor ignores the value.
Response
Streaming response. The body framing depends on the negotiated content type — see the operation summary.