Skip to content
#0857
Curl

Stop generating is an AbortController

The chat UI has a Stop button. On most stacks it stops the rendering and nothing else; the model keeps generating into a proxy nobody is reading.

Your frontend calls the model endpoint through the container's curl channel, using createFetch from @hoody/curl-channel-sdk. The relay detects text/event-stream on the first response byte and promotes the request to streaming in flight; the first token reaches the tab within milliseconds. The Stop button calls controller.abort(). The SDK rejects the pending fetch() at once and sends request.cancel on the wire; the relay cancels the request mid-flight. Dozens of these streams share one WebSocket, each with its own stream_id, each cancelled on its own. Tokens bill through whichever path you chose, the Hoody AI Gateway or your own provider key; the container's flat rate doesn't move.

Stop means stop, all the way to the relay.