Unofficial Unix-style command-line tools for Kagi Search. Kagi Inc. does not make or endorse them.
Each binary does one job:
kagi-searchfinds sourceskagi-mapsfinds places and addresseskagi-summarizesummarizes one explicit URL
Output is plain text by default and compact JSON with --json, for scripts and agents. You need a
Kagi account and its session token.
Releases ship Linux x86_64 and macOS aarch64 builds. Install them with mise, which verifies the GitHub attestation of the release archive:
mise use -g github:rubas/kagiWithout mise, build from source:
cargo install --git https://github.com/rubas/kagiYou need a Kagi session token. The binaries check these sources in order:
- The
KAGI_SESSION_TOKENenvironment variable, when it is not empty. $XDG_CONFIG_HOME/kagi/session-token, or~/.config/kagi/session-tokenwhenXDG_CONFIG_HOMEis unset, empty, or relative.
Without either, they stop with an error.
Create the token file with owner-only permissions (paste the token, then Ctrl-D):
install -d -m 700 ~/.config/kagi
(umask 077; cat > ~/.config/kagi/session-token)The token is a full kagi.com session cookie, so the binaries refuse a token file that is group- or
world-readable (chmod 600 fixes it). This check does not apply to KAGI_SESSION_TOKEN. The
binaries never embed or store secrets.
Each binary lists all its flags with --help.
Searches the web. The text output is numbered results and, when Kagi has them, Related: terms.
The JSON is { "results": [...], "related": [...] }.
kagi-search 'rust async runtime' --lens programming --limit 5
kagi-search 'SBB Fahrplan' --region ch --sort recency --time week
kagi-search 'memory leak' --site github.com --filetype rs --jsonSearches Kagi Maps for places, businesses, and addresses. The text output is numbered places with
the address, coordinates, rating, phone, and URL that Kagi has. The JSON is { "results": [...] }.
kagi-maps 'coffee zurich' --ll 47.3769,8.5417 --zoom 13
kagi-maps 'bookstore near bern' --sort rating --jsonSummarizes one explicit URL. The text output is the raw Markdown summary. The JSON is
{ "summary": "..." }.
kagi-summarize 'https://www.rust-lang.org/learn'
kagi-summarize 'https://www.rust-lang.org/learn' --type takeaway
kagi-summarize 'https://www.rust-lang.org/learn' --lang DE --jsontask checktask lint also runs zizmor over the workflows, so install
zizmor first.