kli-kagi #
A kli extension that adds one model-facing
tool, web_search, backed by the Kagi Search API.
Requirements #
- kli 0.2.2 or newer.
- A Kagi API key with API billing enabled.
KAGI_API_KEYset in the environment that starts kli.
Kagi API usage is billed separately from a Kagi subscription.
Install #
From A Release #
kli's native installer verifies the exact file against its git blob id:
kli install \
https://raw.githubusercontent.com/bottd/kli-kagi/v0.1.0/kli-kagi.lisp \
dfbefb5b92070ff83b1c7e84b7e55153c10df5da
From A Checkout #
The extension is a single file. Load it once while developing:
kli --extension ./kli-kagi.lisp
Or place kli-kagi.lisp in ~/.config/kli/extensions/ to discover it on every
launch. Run /reload after changing the file.
With Nix #
Add both flakes and keep kli aligned between the application and extension:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
kli.url = "github:kleisli-io/kli";
kli-kagi = {
url = "github:bottd/kli-kagi";
inputs.nixpkgs.follows = "nixpkgs";
inputs.kli.follows = "kli";
};
};
}
Then use kli's Home Manager or NixOS module:
programs.kli = {
enable = true;
extensions = [ inputs.kli-kagi.packages.${pkgs.stdenv.hostPlatform.system}.default ];
};
Configuration #
Export the API key before starting kli:
export KAGI_API_KEY="..."
kli
The key is read only when web_search runs. If settings.json restricts kli's
capabilities, include kagi/search:
{
"capabilities": ["kagi/search"]
}
web_search accepts one required query string. It requests up to 10 results
as Markdown and caps tool output at 30,000 characters.
Development #
Run the compiled-extension tests, manifest check, and source-load check:
nix flake check
No live Kagi request runs during the test suite.