1<!--
2SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
3
4SPDX-License-Identifier: CC0-1.0
5-->
6
7# garble
8
9[](https://hex.pm/packages/garble)
10[](https://hexdocs.pm/garble/)
11[](https://api.reuse.software/info/git.secluded.site/garble)
12[](https://liberapay.com/Amolith/)
13
14Transform stdin with an LLM. Pipe text in, get transformed text out.
15
16## tl;dr
17
18```bash
19# Fix typos and grammar
20echo "teh quikc brown fox" | garble --directions "fix typos"
21
22# Translate
23cat letter.txt | garble --directions "translate to Pirate"
24
25# Reformat
26pbpaste | garble --directions "convert to markdown table" | pbcopy
27```
28
29## Installation
30
31```bash
32# Clone and install to ~/.local/bin
33git clone https://git.secluded.site/garble
34cd garble
35make install
36
37# Or install elsewhere
38make install PREFIX=/usr/local
39```
40
41Requires Erlang/OTP and the Gleam toolchain.
42
43## Usage
44
45```bash
46garble [--provider PROVIDER] [--model MODEL] [--directions "..."]
47```
48
49All flags are optional if configured in `~/.config/garble/config.toml`.
50
51### Flags
52
53| Flag | Description | Example values |
54| -------------- | ------------------------------------------- | ------------------------------------------- |
55| `--provider` | Provider ID | `openai`, `anthropic`, `google` |
56| `--model` | Model ID | `gpt-4o`, `claude-3-opus`, `gemini-1.5-pro` |
57| `--directions` | Instructions for how to transform the input | `"fix grammar and spelling"` |
58
59### Configuration
60
61Create `~/.config/garble/config.toml`:
62
63```toml
64provider = "anthropic"
65model = "claude-sonnet-4-20250514"
66directions = "fix grammar and spelling"
67
68# API key options (in order of precedence):
69# 1. Run a command to get the key
70api_key_cmd = "op read 'op://Private/Anthropic/credential'"
71
72# 2. Or set it directly (not recommended)
73# api_key = "sk-..."
74```
75
76If neither `api_key_cmd` nor `api_key` is set, garble falls back to the
77provider's environment variable (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`).
78
79CLI flags override config file values.
80
81## Contributions
82
83Patch requests are in [amolith/llm-projects] on [pr.pico.sh]. You don't
84need a new account to contribute, you don't need to fork this repo, you
85don't need to fiddle with `git send-email`, you don't need to faff with
86your email client to get `git request-pull` working...
87
88You just need:
89
90- Git
91- SSH
92- An SSH key
93
94```sh
95# Clone this repo, make your changes, and commit them
96# Create a new patch request with
97git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/llm-projects
98# After potential feedback, submit a revision to an existing patch request with
99git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
100# List patch requests
101ssh pr.pico.sh pr ls amolith/llm-projects
102```
103
104See "How do Patch Requests work?" on [pr.pico.sh]'s home page for a more
105complete example workflow.
106
107[amolith/llm-projects]: https://pr.pico.sh/r/amolith/llm-projects
108[pr.pico.sh]: https://pr.pico.sh
109
110## License
111
112AGPL-3.0-or-later