top | item 34986447

(no title)

reset-password | 3 years ago

Hopefully there will be a plug-in-your-own-API-key open source thing then. Even better.

discuss

order

b5n|3 years ago

The future is now:

    gptask() {
    data=$(jq -n \
              --arg message "$1" \
              '{model: "gpt-3.5-turbo",
                max_tokens: 4000,
                messages: [{role: "user", content: $message}]}')

    response=$(curl -s https://api.openai.com/v1/chat/completions \
                    -H "Content-Type: application/json" \
                    -H "Authorization: Bearer $OAIKEY" \
                    -d "$data")

    message=$(echo "$response" \
                  | jq '.choices[].message.content' \
                  | sed 's/^\"\\n\\n//;s/\"$//')

    echo -e "$message"
    }

    export OAIKEY=<YOUR_KEY>
    gptask "what is the url for hackernews"

comment_ran|3 years ago

Not to sure how to make it one section, aka, one session mode, so chatgpi can understand the previous talk.