Skip to content

httpjamesm/kagigo

Repository files navigation

kagigo

An unofficial Kagi API client for Go.

Installation

go get -u github.com/httpjamesm/kagigo

Quick Start

Client

client := kagi.NewClient(&kagi.ClientConfig{
    APIKey:     os.Getenv("KAGI_API_KEY"),
    APIVersion: "v0",
})

FastGPT

response, err := client.FastGPTCompletion(kagi.FastGPTCompletionParams{
    Query:     "query",
    WebSearch: true,
    Cache:     true,
})
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(response.Data.Output)

Universal Summarizer

response, err := client.UniversalSummarizerCompletion(kagi.UniversalSummarizerParams{
    URL:         "https://blog.kagi.com/security-audit",
    SummaryType: kagi.SummaryTypeSummary,
    Engine:      kagi.SummaryEngineCecil,
})
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(response.Data.Output)

Enrichment

response, err := client.EnrichmentCompletion(kagi.EndpointTypeWeb, kagi.EnrichmentParams{
    Q: "kagi search",
})
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(response.Data)