Server-Sent Events
Generic event streams for testing how a gateway proxies text/event-stream:
buffering, timeouts, reconnection with Last-Event-ID and response
transformation of streams. (The mock LLM has its own provider-native streams, see
Providers.)
Numbered events: /sse
GET /sse sends numbered events with id: n, data: and, optionally, an event:
name. Query parameters:
| Parameter | Default | Meaning |
|---|---|---|
count | 10 | Number of events (max 1000; 100 in public mode) |
interval_ms | 1000 | Time between events (max 60000; 10000 in public mode) |
event | none | Event name (event: line) |
retry | none | Reconnection delay (retry: line) sent with the first event |
mode | json | json ({"id", "count", "message", "timestamp"}) or text |
heartbeat_ms | 15000 | Comment heartbeat (: heartbeat) while idle; 0 disables |
last_event_id | none | Same as the Last-Event-ID header |
Event ids are sequence numbers: a client that reconnects with Last-Event-ID: 3
resumes at event 4. Streams end after count events, or after 10 minutes (2 in
public mode). Responses carry Cache-Control: no-cache and
X-Accel-Buffering: no so well-behaved proxies do not buffer them.
GET {{base_url}}/sse?count=3&interval_ms=100&event=tick&retry=2000
HTTP 200
[Asserts]
header "Content-Type" == "text/event-stream"
header "Cache-Control" == "no-cache"
body contains "id: 1\nevent: tick\n"
body contains "retry: 2000"
body contains "\"message\":\"event 3 of 3\""
GET {{base_url}}/sse?count=5&interval_ms=50
Last-Event-ID: 3
HTTP 200
[Asserts]
body not contains "id: 3\n"
body contains "id: 4\n"
body contains "id: 5\n"
GET {{base_url}}/sse?count=2&interval_ms=50&mode=text
HTTP 200
[Asserts]
body contains "data: event 1 of 2"
LLM-style text stream: /sse/chat
GET /sse/chat?prompt=&max_tokens=&delay_ms= or POST /sse/chat with
{"prompt", "max_tokens", "delay_ms"} streams a reply one word per event, in a
provider-neutral shape:
data: {"id":"chat-...","object":"chat.chunk","index":0,"delta":"You ","finish_reason":null}
...
data: {"id":"chat-...","object":"chat.chunk","index":5,"delta":"","finish_reason":"length","usage":{...}}
data: [DONE]
delay_ms defaults to 50 (max 2000; 1000 in public mode) and max_tokens to 500
(max 200 in public mode). The last chunk carries finish_reason (stop or length)
and usage.
POST {{base_url}}/sse/chat
Content-Type: application/json
{"prompt": "Tell me a story", "max_tokens": 5, "delay_ms": 20}
HTTP 200
[Asserts]
header "Content-Type" == "text/event-stream"
body contains "\"object\":\"chat.chunk\""
body contains "\"finish_reason\":\"length\""
body contains "\"completion_tokens\":5"
body endsWith "data: [DONE]\n\n"
Other server-sent event streams in Rustybin: the inspector feed, the request bin feed, the MCP Streamable HTTP and legacy HTTP+SSE transports, A2A streaming, and every mock LLM stream.