Show HN: Runprompt – run .prompt files from the command line

https://news.ycombinator.com/rss Hits: 12
Summary

runprompt A single-file Python script for running .prompt files. Quick start | Examples | Configuration | Providers Quick start curl -O https://raw.githubusercontent.com/chr15m/runprompt/main/runprompt chmod +x runprompt Create hello.prompt : --- model : anthropic/claude-sonnet-4-20250514 --- Say hello to {{ name }} ! Run it: export ANTHROPIC_API_KEY= " your-key " echo ' {"name": "World"} ' | ./runprompt hello.prompt Examples In addition to the following, see the tests folder for more example .prompt files. Basic prompt with stdin --- model : anthropic/claude-sonnet-4-20250514 --- Summarize this text: {{ STDIN }} cat article.txt | ./runprompt summarize.prompt The special {{STDIN}} variable always contains the raw stdin as a string. Structured JSON output Extract structured data using an output schema: --- model : anthropic/claude-sonnet-4-20250514 input : schema : text : string output : format : json schema : name? : string, the person's name age? : number, the person's age occupation? : string, the person's job --- Extract info from: {{ text }} echo " John is a 30 year old teacher " | ./runprompt extract.prompt # {"name": "John", "age": 30, "occupation": "teacher"} Fields ending with ? are optional. The format is field: type, description . Chaining prompts Pipe structured output between prompts: echo " John is 30 " | ./runprompt extract.prompt | ./runprompt generate-bio.prompt The JSON output from the first prompt becomes template variables in the second. CLI overrides Override any frontmatter value from the command line: ./runprompt --model anthropic/claude-haiku-4-20250514 hello.prompt ./runprompt --name " Alice " hello.prompt Configuration Environment variables Set API keys for your providers: export ANTHROPIC_API_KEY= " ... " export OPENAI_API_KEY= " ... " export GOOGLE_API_KEY= " ... " export OPENROUTER_API_KEY= " ... " RUNPROMPT_* overrides Override any frontmatter value via environment variables prefixed with RUNPROMPT_ : export RUNPROMPT_MODEL= " anthropic/...

First seen: 2025-11-27 15:37

Last seen: 2025-11-28 02:39