Output Contract
This page documents the current CLI output behavior as implemented in the repo.Core Rules
- Most commands print pretty-formatted JSON to stdout on success.
kagi search,kagi batch,kagi quick, andkagi assistantsupport alternate output via format flags, includingtoonfor token-efficient structured context.- Errors are plain text on stderr and exit with status code
1. - Output shapes differ by command. There is no single universal response envelope.
Success Shapes
kagi search
kagi search --news
The News tab vertical returns a different shape — clusters of articles:
time_relative is preserved verbatim from Kagi’s page (the News tab does not expose absolute timestamps). Single-item clusters represent ungrouped articles at the top of the results page.
kagi batch
Default JSON output uses a structured envelope:
kagi summarize
Public API mode:
kagi news
kagi news --list-categories and kagi news --chaos return different JSON shapes with category metadata or chaos metadata.
kagi assistant
kagi assistant --stream writes incremental markdown deltas to stdout and flushes after each update. kagi assistant --stream --stream-output json writes the same stream as newline-delimited compact JSON events with an md_delta field plus the current meta, thread, and message snapshot.
kagi assistant custom
list returns an array of assistant summaries:
get, create, and update return assistant details:
kagi lens
kagi bang custom
kagi redirect
kagi quick
kagi translate
kagi ask-page
kagi fastgpt
kagi enrich
kagi smallweb
Pretty Search Output
kagi search --format pretty renders results like this:
Pretty Quick Output
kagi quick --format pretty renders:
Pretty Assistant Output
kagi assistant --format pretty renders: