Can it be made to be directly executable with a shebang line?
#!/bin/bash
file="$1"
model=$(sed -n '2p' "$file" | sed 's/^# \*//')
prompt=$(tail -n +3 "$file")
curl -s https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d "{
\"model\": \"$model\",
\"max_tokens\": 1024,
\"messages\": [{\"role\": \"user\", \"content\": $(echo "$prompt" | jq -Rs .)}]
}" | jq -r '.content[0].text'
hello.prompt #!/usr/local/bin/promptrun
# claude-sonnet-4-20250514
Write a haiku about terminal commands.If you curl/wget a script, you still need to chmod +x it. Git doesn't have this issue as it retains the file metadata.
#!/bin/env runprompt
---
.frontmatter...
---
The prompt.
Would be a lot nicer, as then you can just +x the prompt file itself.#/usr/bin/env runprompt