Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2022 20:58
What would you like to do?
# 2022 Alexander Pushkov, licensed ISC
# Usage: gptman curl in humorous style
set -e
mandir="$(mktemp -d gptman.XXXXXX)"
trap "rm -rf ${mandir}" EXIT HUP INT QUIT TERM
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "Write a manpage for '"$*"'. Output in troff format.\n",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}' | jq -r '.choices[0].text' > "${man}"
man "${man}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment