how is a simple Linux terminal application that lets you query an AI chatbot (powered by xAI's Grok) and get plain text answers directly in your terminal. Ask anything—like how to find file sizes in a directory—and get a concise response.
Example:
how --q "find size of files in directory and list by file size"Response:
du -sh | sort -h- Lightweight and dependency-minimal (only requires requests).
- Configurable via a local file (~/.how_config) for your xAI API key.
- Installable system-wide with a simple setup process.
1. Install from PyPI
pip3 install how --userThis installs how to ~/.local/bin, which should be in your PATH. If not, add it:
export PATH="$HOME/.local/bin:$PATH"` - Set Your API Key Configure your xAI API key:
how --key "your-xai-api-key-here"This saves the key to ~/.how_config.
- Ask a Question
how --q "your question here"Example:
how --q "how do I list all running processes?"Output:
"Use this command: ps aux"- Set or Update API Key
how --key "new-xai-api-key"- Check Help
how --help- "No API key found" Error Run how --key "<your-api-key>" to set your key.
- 403 Forbidden Error Verify your API key is valid and has access to the grok-2-latest model in the xAI Console. Regenerate it if needed.
- Command Not Found Ensure ~/.local/bin is in your PATH (see installation step 3).
- ModuleNotFoundError: No module named 'setuptools' Install it with pip3 install setuptools.
Remove the application:
bash
pip3 uninstall howDelete the config file (optional):
bash
rm ~/.how_configFeel free to fork this project, submit issues, or send pull requests. Ideas for improvements:
- Add response caching.
- Support additional AI models.
- Enhance error messages.
This project is open-source under no license.
Built by Gregory Ellis.