A terminal app to query xAI's Grok API
Project description
How
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"
Features
- 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.
Prerequisites
- Python 3: Available on most Linux systems (check with python3 --version).
- pip: For installing dependencies (install with sudo apt-get install python3-pip on Debian/Ubuntu or equivalent).
- xAI API Key: Sign up at xAI and generate a key from the xAI Console API Keys Page.
Installation
Clone or Download the Repository
bash
CollapseWrapCopy
git clone <repository-url>
-
cd how
Or download and extract the zip file. -
Install Dependencies Install setuptools if not already present:
bash
CollapseWrapCopy
pip3 install setuptools -
Install the Application Run the setup script to install how for your user:
bash
CollapseWrapCopy
python3 setup.py install --user
This installs how to ~/.local/bin, which should be in your PATH. If not, add it:
bash
CollapseWrapCopy
export PATH="$HOME/.local/bin:$PATH"
Make it permanent by adding that line to ~/.bashrc or ~/.zshrc. -
Set Your API Key Configure your xAI API key:
bash
CollapseWrapCopy
how --key "your-xai-api-key-here"
This saves the key to ~/.how_config.
Usage
-
Ask a Question
bash
CollapseWrapCopy
how --q "your question here"
Example:
bash
CollapseWrapCopy
how --q "how do I list all running processes?"
Output:
text
CollapseWrapCopy
"Use this command: ps aux" -
Set or Update API Key
bash
CollapseWrapCopy
how --key "new-xai-api-key" -
Check Help
bash
CollapseWrapCopy
how --help
Troubleshooting
- "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.
Uninstallation
Remove the application:
bash
CollapseWrapCopy
pip3 uninstall how
Delete the config file (optional):
bash
CollapseWrapCopy
rm ~/.how_config
Contributing
Feel free to fork this project, submit issues, or send pull requests. Ideas for improvements:
- Add response caching.
- Support additional AI models.
- Enhance error messages.
License
This project is open-source under the MIT License (or specify your preferred license).
Credits
Built with ❤️ by Gregory Ellis using xAI’s Grok API.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file howdo-0.1.0.tar.gz.
File metadata
- Download URL: howdo-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213909b7b67cb1099bf09186557ae01db5e9aeb636ed61a118ff77a56fc48d47
|
|
| MD5 |
649c0c89c51817ea10daf26622dfdd91
|
|
| BLAKE2b-256 |
d08b8f8416b895ce58e4e6f460b35b044a452db8a60a71b17b2d1fafbe7e5c27
|
File details
Details for the file howdo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: howdo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7e18c5de28b09aa2ded8f211a3758b1763c72af992121a4f4bc1373b671d78
|
|
| MD5 |
888e7d66a654c121441f1f696e5ea7c5
|
|
| BLAKE2b-256 |
63bd2c8d461261c0ead6ad436d97bdf7f71b8b45a9959b2edfe2105db2c5c75d
|