It would be nice if we could access the Kagi discussdoc feature through the API. I've provided some examples below on how this could work - the intention is for it to be very similar to how the summarize API works.
Example usages:
GET request, escape codes, Agnes engine
$ curl -v \
-H "Authorization: Bot $TOKEN" \
"https://kagi.com/api/v0/discussdoc?url=https%3A%2F%2Finvisible-island.net%2F&q=In%20XTERM%2C%20how%20are%20escape%20codes%20for%20mouse%20input%20formatted%3F"
POST request with JSON body, escape codes, Daphne engine
$ curl -v \
-XPOST https://kagi.com/api/v0/discussdoc \
-H "Content-Type: application/json" \
-H "Authorization: Bot $TOKEN" \
-d '{"url": "https://invisible-island.net/", \
"engine": "daphne", \
"query": "In XTERM, how are escape codes for mouse input formatted?"}'
Example response:
{
"meta": {
"id": "777z777z-77z7-7777-zz77-z77777777777",
"node": "eu-west2",
"ms": 777
},
"data": {
"output": "In XTERM, the escape codes for mouse input are formatted as follows:\n\n`CSI M CbCxCy`\nWhere CSI is the Control Sequence Introducer (\x1b[), M is the mouse event identifier, Cb is the button code (0 for button 1, 1 for button 2, 2 for button 3, 3 for release), and Cx and Cy are the x and y coordinates of the mouse event, respectively.",
"tokens": 777,
}
}