Skip to content
/ kagi Public

A simple CLI for querying the Kagi search engine via their FastGPT API

License

Notifications You must be signed in to change notification settings

bcspragu/kagi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kagi FastGPT CLI

GoDoc CI Workflow

kagi is a simple CLI for querying the Kagi search engine with their FastGPT API

Installation

First, build + install the kagi CLI with:

go install github.com/bcspragu/kagi/cmd/kagi@latest

Then, create an API key + add API credits, following the official Kagi instructions. Add the API key to your ~/.bashrc or equivalent with something like:

export KAGI_API_KEY=...

If you don't want to expose sensitive credentials to all applications running in your shell, you can wrap the kagi CLI in a shell script, e.g.:

#!/bin/bash

# Maybe this lives in ~/.local/bin, which has a higher precedence than your $GOPATH/bin dir

KAGI_API_KEY=$(some CLI password manager or just hardcode it) $GOPATH/bin/kagi "$@"

# or, if you prefer flags:
# $GOPATH/bin/kagi --kagi_api_key=... "$@"

And you should be good to go! Try running kagi <query> to test it out.

Example Output

$ kagi net/http golang
===== OUTPUT =====

The net/http package is part of the Go standard library and provides HTTP client and server functionality. [1][2][3]

===== REFERENCES =====

1. http package - net/http - Go Packages - https://pkg.go.dev/net/http
  - Package http provides HTTP client and server implementations. ... Manually configuring HTTP/2 via the golang.org/x/net/http2 package takes precedence over...

2. Writing Web Applications - The Go Programming Language - https://go.dev/doc/articles/wiki/
  - Covered in this tutorial: Creating a data structure with load and save methods; Using the net/http package to build web applications; Using the html/...

3. How To Make an HTTP Server in Go | DigitalOcean - https://www.digitalocean.com/community/tutorials/how-to-make-an-http-server-in-go
  - Apr 21, 2022 ... The net/http package not only includes the ability to make HTTP requests, but also provides an HTTP server you can use to handle those requests.

Troubleshooting

If the kagi tool isn't working for you, make sure:

  • You've reloaded your ~/.bashrc or equivalent after adding your API key, e.g. with source ~/.bashrc or opening a new shell.
    • Run echo $KAGI_API_KEY to confirm it's set in the current shell
  • You've 'topped up' your API credits

If you're still having issues after that, feel free to file an issue, including any error output.

About

A simple CLI for querying the Kagi search engine via their FastGPT API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages