Skip to main content
POST
/
question
/
stream
Ask a question (SSE stream)
curl --request POST \
  --url http://localhost:{port}/question/stream \
  --header 'Content-Type: application/json' \
  --data '
{
  "question": "<string>",
  "resources": [
    "<string>"
  ],
  "quiet": true
}
'
import requests

url = "http://localhost:{port}/question/stream"

payload = {
"question": "<string>",
"resources": ["<string>"],
"quiet": True
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({question: '<string>', resources: ['<string>'], quiet: true})
};

fetch('http://localhost:{port}/question/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://localhost:{port}/question/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'question' => '<string>',
'resources' => [
'<string>'
],
'quiet' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "http://localhost:{port}/question/stream"

payload := strings.NewReader("{\n \"question\": \"<string>\",\n \"resources\": [\n \"<string>\"\n ],\n \"quiet\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("http://localhost:{port}/question/stream")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"<string>\",\n \"resources\": [\n \"<string>\"\n ],\n \"quiet\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:{port}/question/stream")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"<string>\",\n \"resources\": [\n \"<string>\"\n ],\n \"quiet\": true\n}"

response = http.request(request)
puts response.read_body
"<string>"
{
"error": "<string>",
"tag": "<string>",
"hint": "<string>"
}
Streams server-sent events for the query lifecycle.

Events

SSE format:
event: <type>
data: <json>
Event types:
  • meta
  • reasoning.delta
  • text.delta
  • tool.updated
  • done
  • error

done

The final event is done. It always includes text, reasoning, and tools, and may include optional usage and metrics:
{
	"type": "done",
	"text": "final answer",
	"reasoning": "full reasoning",
	"tools": [],
	"usage": {
		"inputTokens": 1234,
		"outputTokens": 456,
		"reasoningTokens": 120,
		"totalTokens": 1690
	},
	"metrics": {
		"timing": { "totalMs": 5321, "genMs": 2710 },
		"throughput": {
			"outputTokensPerSecond": 168.3,
			"totalTokensPerSecond": 623.6
		},
		"pricing": {
			"source": "models.dev",
			"modelKey": "openai/gpt-4o-mini",
			"ratesUsdPerMTokens": { "input": 0.14, "output": 0.54 },
			"costUsd": { "input": 0.000173, "output": 0.000246, "total": 0.000419 }
		}
	}
}
Notes:
  • Pricing is best-effort and may be omitted.
  • Pricing rates are USD per 1M tokens from https://models.dev/api.json.

Body

application/json
question
string
required
resources
string[]
quiet
boolean

Response

Server-sent events stream. Event types: meta, reasoning.delta, text.delta, tool.updated, done, error. The final done event may include optional usage and metrics fields.

The response is of type string.