kagiapi
A Rust client library for Kagi's Search, Enrich, FastGPT, and Universal Summarizer APIs.
Features
- Search API - Web search using Kagi's high-quality, privacy-focused results
- Universal Summarizer - Summarize content from URLs or raw text (webpages, PDFs, videos, audio)
- FastGPT - AI-powered answers with automatic web search and citations
- Enrichment API - Discover non-commercial "small web" content and non-mainstream news
- Async/await - Built on
tokioandreqwest - Type-safe - Strongly typed request/response structures
- Error handling - Comprehensive error types with detailed messages
Installation
[]
= "0.0.30"
Usage
Basic Setup
use KagiClient;
let client = new;
Search
use KagiClient;
async
Summarize a URL
use ;
async
Summarize Text Directly
use ;
async
FastGPT
use KagiClient;
async
Enrichment
use ;
async
Custom API Versions
use KagiClient;
let client = with_api_versions;
API Reference
KagiClient Methods
| Method | Description |
|---|---|
new(api_key) |
Create a client with default settings |
with_base_url_prefix(api_key, url) |
Create with custom base URL (for testing) |
with_api_versions(api_key, ...) |
Create with specific API versions per endpoint |
search(query, limit) |
Search the web |
summarize(url, engine, type, lang) |
Summarize content from a URL |
summarize_text(text, engine, type, lang) |
Summarize raw text |
fastgpt(query, cache, web_search) |
AI-powered answers with citations |
enrich(query, type) |
Non-commercial content discovery |
Enums
SummarizerEngine: Cecil (default), Agnes, Daphne, Muriel
SummaryType: Summary (paragraph prose), Takeaway (bullet points)
EnrichType: Web, News
Error Handling
use Error;
match client.search.await
Requirements
- API Key: Get your API key from Kagi Settings
- API Access: The Search API is currently in closed beta. Request access by emailing support@kagi.com
License
MIT License - see LICENSE for details.