Given that the client is probably routstrd + Pi Agent, I would treat this as a client/
daemon streaming compatibility problem, not necessarily a bad Fugu provider setup.
## Simple diagnosis
The error:
Unexpected token 'd', "data: {"id"... is not valid JSON
means something received this kind of response:
data: {"id":"..."}
data: {"id":"..."}
data: [DONE]
…but tried to read it as normal JSON.
That data: format is Server-Sent Events streaming, which Routstr documents as the expected format
when stream: true is used. Routstr’s non-streaming default is stream: false; when stream: true,
responses are sent as data: ... lines ending with data: [DONE]. (docs.routstr.com
(https://docs.routstr.com/api/endpoints/))
So the likely chain is:
Pi Agent
→ routstrd
→ your Routstr node
→ Sakana Fugu
→ returns streaming data
Then either Pi Agent or routstrd tries to parse the whole streaming response as one JSON object and
crashes.
## Why routstrd is suspicious here
Routstrd is meant to sit locally between agents like Pi Agent and Routstr providers. Routstr’s own
page says routstrd can onboard Pi Agent, discover Routstr nodes, and auto-route to providers.
(routstr.com (https://routstr.com/routstrd))
The routstrd README says its daemon API accepts a body with:
{
"model": "model-id",
"messages": [],
"stream": false
}
and shows a normal JSON response, not an SSE stream. (github.com
(https://github.com/Routstr/routstrd))
That does not prove routstrd cannot stream, but it supports the practical guess: routstrd/Pi may be
taking a streaming response and handling it as non-streaming JSON.
## Most likely cause
Most likely:
> Pi Agent is requesting streaming, or routstrd is forwarding a streaming request, but routstrd/Pi is not correctly consuming the streaming response from your Fugu-backed Routstr node.
Your Routstr node may be doing the right thing by returning data: {...} lines if the request included stream: true.
Login to reply
Replies (1)
Thank you for the diagnosis. Will look into this further.
Actually, Routstrd's default mode is streaming mode. Most of Routstr's requests go through routstrd, and fugu model worked for 8 requests, in streaming mode, before it broke.
Will try to reproduce this and see where the issue is.