A single-file Python script for running .prompt files.
Quick start | Examples | Configuration | Providers
curl -O https://raw.githubusercontent.com/chr15m/runprompt/main/runprompt
chmod +x runpromptCreate hello.prompt:
Run it:
export ANTHROPIC_API_KEY="your-key"
echo '{"name": "World"}' | ./runprompt hello.promptIn addition to the following, see the tests folder for more example .prompt files.
cat article.txt | ./runprompt summarize.promptThe special {{STDIN}} variable always contains the raw stdin as a string.
Extract structured data using an output schema:
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.
Pipe structured output between prompts:
echo "John is 30" | ./runprompt extract.prompt | ./runprompt generate-bio.promptThe JSON output from the first prompt becomes template variables in the second.
Override any frontmatter value from the command line:
./runprompt --model anthropic/claude-haiku-4-20250514 hello.prompt
./runprompt --name "Alice" hello.promptSet API keys for your providers:
export ANTHROPIC_API_KEY="..."
export OPENAI_API_KEY="..."
export GOOGLE_API_KEY="..."
export OPENROUTER_API_KEY="..."Override any frontmatter value via environment variables prefixed with RUNPROMPT_:
export RUNPROMPT_MODEL="anthropic/claude-haiku-4-20250514"
./runprompt hello.promptThis is useful for setting defaults across multiple prompt runs.
Use -v to see request/response details:
./runprompt -v hello.promptModels are specified as provider/model-name:
| Provider | Model format | API key env var |
|---|---|---|
| Anthropic | anthropic/claude-sonnet-4-20250514 |
ANTHROPIC_API_KEY |
| OpenAI | openai/gpt-4o |
OPENAI_API_KEY |
| Google AI | googleai/gemini-1.5-pro |
GOOGLE_API_KEY |
| OpenRouter | openrouter/anthropic/claude-sonnet-4-20250514 |
OPENROUTER_API_KEY |
OpenRouter provides access to models from many providers (Anthropic, Google, Meta, etc.) through a single API key.