| 1 | # promptcmd |
| 2 | |
| 3 | [Quick Start](#quick-start) | [Documentation](https://docs.promptcmd.sh) | [Examples](#examples) |
| 4 | |
| 5 | **promptcmd** is a manager and executor for programmable prompts. Define a |
| 6 | prompt template once, then execute it like any other terminal command, complete |
| 7 | with argument parsing, `--help` text, and stdin/stdout integration. |
| 8 | |
| 9 |  |
| 10 | |
| 11 | Unlike tools that require you to manually manage prompt files or rely on |
| 12 | implicit tool-calling, promptcmd gives you explicit control over what data your |
| 13 | models access. Build compositional workflows by nesting prompts, executing |
| 14 | shell commands within templates, and piping data through multi-step AI |
| 15 | pipelines. |
| 16 | |
| 17 | ## Key Features |
| 18 | |
| 19 | ### Prompts as CLI Commands |
| 20 | |
| 21 | Create a `.prompt` file, enable it with `promptctl`, and execute it like any |
| 22 | native tool. |
| 23 | |
| 24 | ```bash |
| 25 | $ promptctl create bashme_a_script_that |
| 26 | $ bashme_a_script_that renames all files in current directly to ".backup" |
| 27 | ``` |
| 28 | |
| 29 | [More on Execution](https://docs.promptcmd.sh/usage/exec). |
| 30 | |
| 31 | ### Execute in Remote Shells |
| 32 | |
| 33 | Prepend SSH commands with `promptctl`, your prompts magically appear in your |
| 34 | remote shell sessions. |
| 35 | |
| 36 | ```bash |
| 37 | $ promptctl ssh user@server |
| 38 | server $ bashme_a_script_that renames all files in current directly to ".backup" |
| 39 | ``` |
| 40 | |
| 41 | [More on SSH Integration](https://docs.promptcmd.sh/integrations/ssh). |
| 42 | |
| 43 | ### Local and Remote Provider Support |
| 44 | |
| 45 | Use your Ollama endpoint or configure an API key for OpenAI, OpenRouter, |
| 46 | Anthropic, Google, or MiniMax. Swap between them with ease. |
| 47 | |
| 48 | ```bash |
| 49 | $ promptctl create render-md |
| 50 | $ cat README.md | render-md -m openai |
| 51 | $ cat README.md | render-md -m ollama/gpt-oss:20b |
| 52 | ``` |
| 53 | |
| 54 | [More on Providers](https://docs.promptcmd.sh/configuration/providers). |
| 55 | |
| 56 | ### Group and Load Balancing |
| 57 | |
| 58 | Distribute requests across several providers with equal or weighted distribution |
| 59 | for cost optimization. |
| 60 | |
| 61 | ```toml |
| 62 | # config.toml |
| 63 | [groups.balanced] |
| 64 | providers = ["openai", "google"] |
| 65 | ``` |
| 66 | ```bash |
| 67 | $ cat README.md | render-md -m balanced |
| 68 | ``` |
| 69 | |
| 70 | [More on Groups](https://docs.promptcmd.sh/configuration/groups). |
| 71 | |
| 72 | ### Caching |
| 73 | |
| 74 | Cache responses for a configured amount of time for adding determinism in |
| 75 | pipelines and more efficient token consumption. |
| 76 | |
| 77 | ```toml |
| 78 | # config.toml |
| 79 | [providers.openai] |
| 80 | cache_ttl = 60 # number of seconds |
| 81 | ``` |
| 82 | |
| 83 | Set/Override during execution: |
| 84 | |
| 85 | ```bash |
| 86 | $ cat README.md | render-md --config-cache-ttl 120 |
| 87 | ``` |
| 88 | |
| 89 | [More on Caching](https://docs.promptcmd.sh/configuration/caching). |
| 90 | |
| 91 | ### Custom Models with Character |
| 92 | |
| 93 | Use Variants to define custom models with own personality or specialization in |
| 94 | tasks: |
| 95 | |
| 96 | ```config.toml |
| 97 | [providers.anthropic] |
| 98 | api_key = "sk-xxxxx" |
| 99 | model = "claude-sonnet-4-5" |
| 100 | |
| 101 | [providers.anthropic.glados] |
| 102 | system = "Use sarcasm and offending jokes like the GlaDoS character from Portal." |
| 103 | |
| 104 | [providers.anthropic.wheatley] |
| 105 | system = "Reply as if you are Wheatley from Portal." |
| 106 | ``` |
| 107 | |
| 108 | ```bash |
| 109 | $ tipoftheday -m glados |
| 110 | $ tipoftheday -m wheatley |
| 111 | ``` |
| 112 | |
| 113 | [More on Variants](https://docs.promptcmd.sh/configuration/variants). |
| 114 | |
| 115 | ## Quick Start |
| 116 | |
| 117 | ### Install |
| 118 | |
| 119 | **Linux/macOS:** |
| 120 | ```bash |
| 121 | curl -LsSf https://installer.promptcmd.sh | sh |
| 122 | ``` |
| 123 | |
| 124 | **macOS (Homebrew):** |
| 125 | ```bash |
| 126 | brew install tgalal/tap/promptcmd |
| 127 | ``` |
| 128 | |
| 129 | **Windows (PowerShell):** |
| 130 | ```powershell |
| 131 | powershell -ExecutionPolicy Bypass -c "irm https://installer-ps.promptcmd.sh | iex" |
| 132 | ``` |
| 133 | |
| 134 | ### Configure API Keys |
| 135 | |
| 136 | Configure your API keys by editing `config.toml`: |
| 137 | |
| 138 | ```bash |
| 139 | promptctl config edit |
| 140 | ``` |
| 141 | Find your provider's name, e.g., for anthropic: |
| 142 | |
| 143 | ```toml |
| 144 | [providers.anthropic] |
| 145 | api_key = "sk-ant-api03-..." |
| 146 | ``` |
| 147 | |
| 148 | Alternatively, you can set the keys via Environment Variables: |
| 149 | |
| 150 | ``` |
| 151 | PROMPTCMD_ANTHROPIC_API_KEY="your_api_key" |
| 152 | PROMPTCMD_OPENAI_API_KEY="your_api_key" |
| 153 | PROMPTCMD_ANTHROPIC_API_KEY="your_api_key" |
| 154 | PROMPTCMD_OPENROUTER_API_KEY="your_api_key" |
| 155 | PROMPTCMD_MINIMAX_API_KEY="your_api_key" |
| 156 | ``` |
| 157 | |
| 158 | ### Create Your First Prompt |
| 159 | |
| 160 | Create a `summarize.prompt` file: |
| 161 | |
| 162 | ```bash |
| 163 | promptctl create summarize |
| 164 | ``` |
| 165 | |
| 166 | Insert the following: |
| 167 | |
| 168 | ```yaml |
| 169 | --- |
| 170 | model: anthropic/claude-sonnet-4-5 |
| 171 | input: |
| 172 | schema: |
| 173 | words?: integer, Summary |