What is this? • Installation • Usage • Contributing
bilu is a lightweight, focused CLI tool that converts natural language into shell commands using Large Language Models (LLMs) like GPT-5. Unlike comprehensive agentic development tools like Claude Code or Cursor, bilu has a simple, singular purpose: helping you write shell commands faster, without switching context.
bilu is not a replacement for comprehensive agentic development tools -- it is simple tool that excels at one thing. Consider it the terminal equivalent of quickly searching "how do I..." and getting an immediately runnable answer.
After a response is generated, you can edit it before pressing enter to execute the command. This is useful if you want to add flags, or other modifications to the command.
You can install bilu with a single command:
curl -fsSL https://raw.githubusercontent.com/freddyjaoko/bilu/main/install.sh | shThis will automatically detect your OS and architecture, download the correct compiled binary, and place it in your PATH.
Go to the GitHub Releases page, download the binary for your platform, make it executable, and move it to your PATH:
chmod +x bilu-linux-x64
mv bilu-linux-x64 /usr/local/bin/bilu-cligit clone https://github.com/freddyjaoko/bilu.git
cd biluMake sure you have Bun installed.
bun install
bun run buildThis will produce the bilu-cli binary in the dist/ build output directory.
chmod +x dist/bilu-cli
mv dist/bilu-cli /usr/local/bin/bilu-clibilu is configured through a single config.json file. The first time you run bilu, it will automatically launch an interactive setup wizard to help you configure your provider and API key.
The config.json file is located in a standard, platform-specific directory:
- Linux:
~/.config/bilu/config.json - macOS:
~/Library/Preferences/bilu/config.json - Windows:
%APPDATA%\\bilu\\config.json(e.g.,C:\\Users\\<user>\\AppData\\Roaming\\bilu\\config.json)
You can configure bilu to use different AI providers. The supported types are "OpenAI", "Custom", "Claude", "Gemini", and "GitHub".
Below are examples for each provider type.
This is the default configuration.
{
"type": "OpenAI",
"apiKey": "sk-your_openai_api_key",
"model": "gpt-4o"
}apiKey: Your OpenAI API key. If this is empty,biluwill use theOPENAI_API_KEYenvironment variable.
Uses the native Anthropic API.
{
"type": "Claude",
"apiKey": "your-anthropic-api-key",
"model": "claude-3-5-sonnet-20240620"
}apiKey: Your Anthropic API key. If this is empty,biluwill use theANTHROPIC_API_KEYenvironment variable.
Uses the native Google Gemini API.
{
"type": "Gemini",
"apiKey": "your-google-api-key",
"model": "gemini-1.5-flash"
}apiKey: Your Google Gemini API key. If this is empty,biluwill useGEMINI_API_KEYorGOOGLE_API_KEYenvironment variables.
Uses multiple free to use GitHub models.
{
"type": "GitHub",
"apiKey": "your-github-token",
"model": "gpt-4o"
}apiKey: Your GitHub token. If this is empty,biluwill useGITHUB_TOKENorGITHUB_API_KEYenvironment variables.
This type is for any other OpenAI-compatible API endpoint, such as Ollama, LM Studio, or a third-party proxy service.
{
"type": "Custom",
"model": "llama3",
"baseURL": "http://localhost:11434/v1",
"apiKey": "ollama"
}model: The name of the model you want to use (e.g.,"llama3").baseURL: The API endpoint for the service.apiKey: An API key, if required by the service. For local models like Ollama, this can often be a non-empty placeholder like"ollama".
bilu can include recent command history from your shell to provide better context for command generation. This feature is disabled by default but can be enabled. When enabled, bilu includes the raw last N lines from your shell history (e.g., bash, zsh, fish), preserving any extra metadata your shell records:
{
"type": "OpenAI",
"apiKey": "sk-your_api_key",
"model": "gpt-4o",
"context": {
"enabled": true,
"maxHistoryCommands": 10
}
}enabled: Whether to include command history context (default:false)maxHistoryCommands: Number of recent commands to include (default:10) When enabled,biluautomatically detects and parses history from bash, zsh, and fish shells.
- Chunk size unit: When scanning shell history files,
bilureads from the end of the file in fixed-size chunks of 64 KiB. This is not currently configurable but can be made if desired.
- History detection: On Windows,
bilusearches for PowerShell PSReadLine history at:%APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt(Windows PowerShell 5.x)%APPDATA%\Microsoft\PowerShell\PSReadLine\ConsoleHost_history.txt(PowerShell 7+) If not found, it falls back to Unix-like history files that may exist when using Git Bash/MSYS/Cygwin (e.g.,.bash_history,.zsh_history).
- Directory listing: On Windows, directory listing uses
dir /b; on Linux/macOS it usesls.
bilu can automatically copy generated commands to your system clipboard:
{
"type": "OpenAI",
"apiKey": "sk-your_api_key",
"model": "gpt-4o",
"clipboard": true
}clipboard: Whether to automatically copy generated commands to clipboard (default:false)
When enabled, every command generated by bilu is automatically copied to your system clipboard, making it easy to paste commands elsewhere. The clipboard integration works cross-platform:
- macOS: Uses
pbcopy - Windows: Uses
clip - Linux: Uses
xcliporxsel(falls back toxselifxclipis not available)
Note: On Linux, you'll need either xclip or xsel installed for clipboard functionality to work.
This function lets you type bilu <description> and get an editable command preloaded in your shell.
# ~/.zshrc
bilu() {
local cmd
cmd="$(bilu-cli "$@")" || return
vared -p "" -c cmd
print -s -- "$cmd" # add to history
eval "$cmd"
}After editing ~/.zshrc, reload it:
source ~/.zshrcbilu() {
local cmd
cmd="$(bilu-cli "$@")" || return
# requires interactive shell and Bash 4+
read -e -i "$cmd" -p "" cmd || return
builtin history -s -- "$cmd"
eval -- "$cmd"
}Note: This only applies to Windows with Powershell installed
To your Powershell profile, add this snippet
function bilu {
param(
[Parameter(ValueFromRemainingArguments=$true)]
$args
)
$Source = '
using System;
using System.Runtime.InteropServices;
public class ConsoleInjector {
[StructLayout(LayoutKind.Sequential)]
public struct KEY_EVENT_RECORD {
public bool bKeyDown;
public ushort wRepeatCount;
public ushort wVirtualKeyCode;
public ushort wVirtualScanCode;
public char UnicodeChar;
public uint dwControlKeyState;
}
[StructLayout(LayoutKind.Sequential)]
public struct INPUT_RECORD {
public ushort EventType;
public KEY_EVENT_RECORD KeyEvent;
}
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteConsoleInput(
IntPtr hConsoleInput,
INPUT_RECORD[] lpBuffer,
int nLength,
out int lpNumberOfEventsWritten
);
const int STD_INPUT_HANDLE = -10;
const ushort KEY_EVENT = 0x0001;
public static void SendCommand(string text) {
IntPtr hIn = GetStdHandle(STD_INPUT_HANDLE);
var records = new INPUT_RECORD[text.Length];
int i = 0;
for (; i < text.Length; i++) {
records[i].EventType = KEY_EVENT;
records[i].KeyEvent.bKeyDown = true;
records[i].KeyEvent.wRepeatCount = 1;
records[i].KeyEvent.UnicodeChar = text[i];
}
int written;
WriteConsoleInput(hIn, records, i, out written);
}
}';
$cmd = bilu-cli @args;
Add-Type -TypeDefinition $Source;
[ConsoleInjector]::SendCommand($cmd)
}This will work for Powershell terminals. To add this functionality to Conhost / Terminal, save this as bilu.bat and let it be accessible in PATH (you must do the Powershell step as well). For example,
:: assumes that ECHO ON and CHCP 437 is user preference
@ECHO OFF
CHCP 437 >NUL
POWERSHELL bilu %*
@ECHO ONTo update bilu to the latest version, simply run the one-line installation command again:
curl -fsSL https://raw.githubusercontent.com/freddyjaoko/bilu/main/install.sh | shThis will replace your bilu-cli binary with the newest compiled release. The installer automatically detects if your PATH and shell helper functions are already set up and will skip duplicating them.
To completely remove bilu from your system:
- Delete the binary:
rm -f /usr/local/bin/bilu-cli # or ~/.local/bin/bilu-cli - Remove configuration & secrets (your API keys):
rm -rf ~/.config/bilu - Clean up shell profile:
Open your shell profile (e.g.
~/.bashrcor~/.zshrc) and delete the PATH export and helper function block added by the installer under the# Added by bilu installercomments. (For Fish users, also delete the function file:rm -f ~/.config/fish/functions/bilu.fish)
Once installed and configured:
bilu generate a new ssh key called bilu-key and add it to the ssh agentYou'll see the generated command in your shell's input line. Press Enter to run it, or edit it first. Executed commands will show up in your shell's history just like any other command.
Contributions are welcome! Please feel free to submit a pull request.