AIx: ProjectDiscovery's Minimalist CLI for Piping Unix Philosophy into GPT
Hook
Most AI CLI tools try to recreate ChatGPT in your terminal. AIx does the opposite: it treats GPT like grep, awk, or any other Unix utility you'd chain in a pipeline.
Context
The explosion of LLM-powered CLI tools in 2023-2024 produced a predictable pattern: rich REPL interfaces, conversation history, colorful TUIs, and feature bloat. Tools like shell-gpt and aichat raced to become "your terminal copilot," adding context management, multiple provider support, and interactive sessions.
ProjectDiscovery—the team behind security tools like nuclei, subfinder, and httpx—saw a different need. Their workflows involve chaining small, composable utilities in shell scripts and automation pipelines. They needed GPT access that behaved like a Unix tool: read from stdin, write to stdout, exit. No state, no sessions, no fancy rendering unless explicitly requested. AIx is their answer: a deliberately minimal Go binary that does one thing—forward prompts to OpenAI's API—and integrates seamlessly with pipes, redirects, and command substitution.
Technical Insight
AIx's architecture is almost aggressively simple, which is precisely its strength. The core is a thin wrapper around the go-openai library, with the entire request lifecycle handled in under 500 lines of Go code. It parses flags, constructs an OpenAI API request, streams the response, and formats output. No local state, no configuration files beyond API keys, no persistent processes.
The tool supports three input methods that make it pipeline-friendly:
# Direct string input
aix -p "Explain TCP handshakes in one sentence"
# Stdin piping
echo "Summarize this log" | cat error.log - | aix
# File input
aix -P prompt.txt
This flexibility makes it trivial to compose with existing Unix tools. Want to summarize all TODO comments in your codebase? grep -r "TODO" . | aix -p "Categorize these todos by urgency". Need to generate test data? aix -p "Generate 10 realistic email addresses" -o jsonl > test_emails.txt.
The JSONL output mode deserves special attention. Unlike most CLI tools that pretty-print responses, AIx can emit newline-delimited JSON when passed -o jsonl, making it easy to parse in jq, Python scripts, or other data processing tools:
# Batch process multiple prompts
cat prompts.txt | while read prompt; do
aix -p "$prompt" -o jsonl | jq -r '.choices[0].message.content'
done
ProjectDiscovery also built in system context configuration, letting you prime the model with specialized instructions. This is where AIx shines for domain-specific automation:
# Create a security-focused analyst
aix -s "You are a security researcher analyzing subdomain enumeration results.
Identify potentially interesting targets for further investigation." \
-p "$(cat subdomains.txt)"
# Or use it for code review in CI/CD
git diff HEAD~1 | aix -s "You are a code reviewer focused on security vulnerabilities.
Flag any potential issues." -m gpt-4
The streaming implementation is straightforward but effective. AIx uses OpenAI's SSE (Server-Sent Events) streaming API, printing tokens as they arrive. For markdown output (the default), it passes the complete response through the glamour library for terminal rendering. For JSONL, it accumulates the stream and emits the full API response as a single JSON object, preserving all metadata like token counts and finish reasons.
One clever design choice: AIx doesn't handle rate limiting, retries, or complex error recovery. This sounds like a limitation until you realize it aligns perfectly with Unix philosophy. Want retries? Wrap it in a shell loop or use the timeout and retry commands. Need rate limiting across multiple calls? That's what xargs -P throttling or external tools like parallel are for. By refusing to solve these problems internally, AIx stays small, auditable, and composable with existing battle-tested Unix utilities.
The Go implementation also means it's a single static binary with no runtime dependencies—just drop it in /usr/local/bin and go. For teams already using ProjectDiscovery's other tools, this fits the same deployment model: lightweight, portable, and easy to version-control in dotfiles or infrastructure repos.
Gotcha
The biggest limitation is right in the name: despite claiming to interact with "Large Language Models APIs" (plural), AIx only supports OpenAI. No Anthropic Claude, no Google Gemini, no local models via Ollama or llama.cpp. If you want provider flexibility, you'll need a different tool or maintain multiple CLI utilities.
The stateless design, while philosophically pure, becomes painful for multi-turn conversations. There's no conversation history, no session management, no automatic context carrying between calls. If you need to build on previous responses, you must manually pipe them back:
# Awkward multi-turn conversation
RESPONSE1=$(aix -p "What's a merkle tree?")
echo "$RESPONSE1" | aix -p "Now explain it to a 5-year-old"
This works but feels clunky compared to tools with native session support. AIx also lacks support for newer OpenAI features like function calling, vision API (GPT-4V), or DALL-E integration. It's a text-in-text-out tool, period. If your automation needs structured outputs or multi-modal capabilities, you'll be writing more complex scripts or reaching for the OpenAI SDK directly.
Verdict
Use AIx if: you're building shell scripts or automation pipelines that need GPT integration, you value simplicity and auditability over features, you're already in the ProjectDiscovery ecosystem, or you want a single static binary with zero dependencies. It's perfect for batch processing, one-off queries in CI/CD, or composing with grep/awk/sed/jq workflows. Skip it if: you need interactive conversations with history, you want to use Claude or other non-OpenAI models, you're looking for a ChatGPT replacement in your terminal, or you need advanced features like function calling or vision. In those cases, grab aichat for multi-provider support or shell-gpt for richer terminal UX. AIx isn't trying to be your AI assistant—it's trying to be curl for LLMs, and it succeeds admirably at that specific goal.