Show HN: Bash4LLM+ – A lightweight, dependency-free Bash wrapper for LLM APIs
TL;DR Highlight
A Bash-only wrapper with curl and jq calls OpenAI-compatible LLM APIs from the CLI and TUI
Who Should Read
Developers who want to call LLM APIs from the shell in minimal environments like servers or Termux without Python or Node
Core Mechanics
- One Bash file calls the LLM
- The core needs only bash 4.0+, coreutils, awk, curl and jq.
- It uses OpenAI-compatible APIs with Groq as the default provider.
- Providers are added as modules
- Gemini, Mistral and HuggingFace plug in as extras modules chosen with --provider.
- The model list comes from GET /v1/models, so no model names are hardcoded.
- CLI, pipes and threads are supported
- Use a prompt argument, stdin pipe, -f file input, or --batch (one prompt per line).
- --thread keeps multi-turn context and history is saved as NDJSON (one JSON object per line).
- API keys get extra protection
- --vault uses OpenSSL with AES-256-CBC, PBKDF2 at 100,000 iterations and a Master Password.
- Temp files go in a dedicated 0700 directory instead of /tmp.
- Tests check that API keys don't show up in the process list while curl runs.
- Responses can be validated in code
- --validate-regex checks the response against a POSIX ERE pattern.
- --validate-sml checks SML v2.0 structure.
- A failed validation returns exit code 13.
- Extras modules are signature-checked
- Extras are verified with a SHA-256 manifest and an Ed25519 signature.
- A mismatch returns exit code 17 (BASH4LLM_ERR_SEC).
- The GUI is optional and needs Python 3.10+ and FastAPI.
Community Reactions
- Opinion that the code is overkill
- One commenter said 5k lines of Bash for simple POSTs and file I/O is overkill.
- They called the code repetitive, verbose and hard to follow.
- Opinion that LLM-written code is hard for LLMs to edit
- One commenter argued longer code makes LLMs worse at editing and auditing it.
- They claimed fewer lines keep models smarter and save money in the long run.
- Author explains the design goals
- The author said Python is slow, Node is heavy and Go needs per-OS binaries.
- They cited a single copy-and-run file that you can open and read as the benefit.
- Experience with a similar project
- One commenter built llayer, a REPL/agent in bash, curl and jq wrapping local Ollama.
- They said they followed the Unix philosophy with small composable parts.
- Author follow-up on cleanup
- The author said they removed redundant chmod calls in safe_mkdir and a duplicate provider scan.
How to Apply
- Check the payload with dry-run first
- Clone the repo, copy bin/bash4llm, and run --dry-run to see the request JSON.
- Then run --refresh-models to fetch the model list.
- Add an LLM review step to a shell pipe
- Pipe logs or scripts with cat file | ./bash4llm "request".
- Bundle repeated jobs into a --batch file.
- Enforce response format with a regex
- Pass the expected format to --validate-regex in automation scripts.
- Branch on exit code 13 to retry or fail.
- Store the API key in the vault
- On shared servers, encrypt the key with --vault instead of using an env var.
- Set BASH4LLM_REQUIRE_VAULT to enforce vault use.
Try It
git clone --depth 1 --branch main https://github.com/kamaludu/bash4llm.git repo-bash4llm
mkdir -p bash4llm && cp repo-bash4llm/bin/bash4llm bash4llm/ && chmod +x bash4llm/bash4llm
cd bash4llm
./bash4llm --refresh-models
./bash4llm --dry-run "Test payload generation"
cat ../repo-bash4llm/bin/bash4llm | ./bash4llm "Analyze this script"Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques