@fettstorch/clai
v0.1.17
Published
AI-powered webpage summarizer
Readme
Command Line AI Interface (CLAI)
An AI-powered question answering tool for the terminal. Get instant answers to your questions using OpenAI, with optional web crawling capabilities. Built for fun in order to learn more about AI and CLIs.
Installation
Use this global installation in order to use the command line tool
npm install clai -gInstall it locally in order to use the clai function in your project.
npm install claiUsing both the CLI tool and the clai function requires an OpenAI API key. For the CLI tool make sure to set the OPENAI_API_KEY environment variable.
OpenAI API Key Setup
- Check this project's code on GitHub in order to make sure I will not store your key :)
- Go to OpenAI's API platform
- Sign up or log in to your OpenAI account
- Click "Create new secret key"
- Copy your API key
- Set it as an environment variable:
Features
Default Behavior - Direct AI Answering
By default, CLAI uses OpenAI directly to answer your questions without web crawling:
clai "how tall can giraffes get?"
clai how tall can giraffes get
clai "explain quantum computing"
claiOptional Web Crawling
Use the -c or --crawl flag to enable web scraping and search engine functionality:
clai -c "latest news about AI"
clai --crawl https://example.com
clai -c "current Bitcoin price"The CLI accepts questions, search queries, or URLs. When passing queries without quotes, avoid special characters that might confuse the CLI (e.g., ?).
Programmatic API
import clai from 'clai';
// Direct AI answering (default)
const { summary, links, sources } = await clai('how tall can giraffes get?', 'your-openai-api-key');
// With web crawling enabled
const { summary, links, sources } = await clai('https://example.com', 'your-openai-api-key', true);Issues
- When using web crawling (
-cflag): search engines often fail due to scraping protections - When using web crawling (
-cflag): large sites might surpass the token limit (currently not handled gracefully) - Web crawling results may not always fit the user's query well
License
ISC
