vikrant69g blog

Someone wrapped every major LLM API in 500 lines of Bash

A GitHub repo called Bash4LLM+ does what Python libraries do in thousands of lines, using only shell builtins and curl.

Terminal window showing a Bash script calling an LLM API with streaming output

I found Bash4LLM+ on Hacker News this morning. It is a single Bash script that talks to OpenAI, Anthropic, Google, and a dozen other LLM APIs. No pip install. No virtual environments. No dependency hell. The whole thing is five hundred lines of Bash. It uses curl for HTTP and jq for JSON parsing. That is the entire stack. You point it at an API key and a model name, pipe in a prompt, get streaming responses back. What caught me is the streaming implementation. Most Python wrappers for Claude or GPT hide the complexity of server-sent events behind async iterators. This repo just reads the curl output line by line and prints tokens as they arrive. Twelve lines of code. The limitation is obvious: no structured outputs, no function calling, no vision models. It is strictly text in, text out. But for the use case of “I need to call an LLM from a CI pipeline” or “I want to prototype a chatbot in a shell script”, it is perfect. I have written three different Python scripts this year that wrap the OpenAI SDK just to add retry logic or cost tracking. Each one pulled in requests, backoff, pydantic. Each one was eighty lines before it did anything useful. This Bash version would have been faster. The trade-off is error handling. Python gives you typed exceptions and structured logging. Bash gives you exit codes and stderr. For production systems, I would still reach for a proper SDK. For one-off tasks or cron jobs, this is cleaner than installing a whole runtime.


Source: Show HN: Bash4LLM+ – A lightweight, dependency-free Bash wrapper for LLM APIs