ask-ai
A Lightweight Bash CLI for AI API Interactions
Minimal, cross-platform tool for interacting with OpenAI, Anthropic, and Ollama APIs. Only depends on bash, curl, and jq.
Features
Lightweight
Only requires bash, curl, and jq. No heavy dependencies or complex installations.
Cross-Platform
Works on Linux, macOS, and Windows (via Git Bash). True portability.
Multiple APIs
Support for OpenAI, Anthropic, and local Ollama APIs in one tool.
Pipe Support
Seamlessly integrate with Unix pipelines for powerful workflows.
JSON Output
Option for structured JSON responses for programmatic processing.
Secure
Automatic file permissions, error sanitization, and security warnings.
Installation
Clone the repository
git clone https://github.com/live-by-unix/ask-ai.git
cd ask-ai
Install dependencies
# Ubuntu/Debian
sudo apt-get install curl jq
# macOS
brew install curl jq
Make executable
chmod +x ask-ai
Configure
./ask-ai config
(Optional) Create an alias
# Add to ~/.bashrc or ~/.zshrc
alias ask-ai='/path/to/ask-ai/ask-ai'
# Reload shell
source ~/.bashrc
Usage Examples
# Interactive configuration wizard
./ask-ai config
# Pipe model name to config
echo "gpt-4" | ./ask-ai config
# Interactive chat
./ask-ai chat gpt-4
# Pipe input
echo "Explain quantum computing" | ./ask-ai chat claude-3
# JSON output
./ask-ai chat gpt-4 --json
# Pipe to file
cat prompt.md | ./ask-ai chat gpt-5.5 > response.md
# From file
cat prompt.md | ./ask-ai chat gpt-4
# From command output
ls -la | ./ask-ai chat gpt-4
# Chain commands
curl -s https://api.example.com/data | ./ask-ai chat gpt-4
Interactive Demo
Try the interactive terminal simulation below to see ask-ai in action.
Try these commands:
Ready to get started?
Install ask-ai today and start interacting with AI APIs from your terminal.