Streaming
Real-time responses via Server-Sent Events, compatible with the OpenAI streaming format.
Enable streaming
Set "stream": true in the request body.
curl https://api.pathfinder.dev/v1/chat \
-H "Authorization: Bearer pf_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"messages": [{ "role": "user", "content": "Explain recursion" }],
"stream": true
}'SSE format
Each chunk is a standard SSE event. The stream ends with [DONE].
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":" world"},"index":0}]}
data: [DONE]Error handling
If the upstream provider drops the connection mid-stream, PathFinder emits an error frame before closing:
event: error
data: {"error":{"message":"Stream truncated","type":"provider_error","code":"stream_truncated"}}Billing
Billing for truncated streams uses a token estimate based on characters streamed (chars / 4). Complete streams use the actual token count from the provider.
Limitations
- Idempotencyis not available for streaming requests — only non-streaming calls can be safely replayed.
- Response headers (
X-Routed-Model, etc.) are sent before the stream begins, so they are always available even if the stream drops.