June 21, 2023, 10:22 a.m. | Peter Vivo

DEV Community dev.to

I often need to quickly ask ChatGPT something using a Linux/GitBash terminal, so I wrote this bash script to facilitate that. Main goal is terminal friendly output, without any additional dependency requirement for gitbash, so I used curl,sed and fold.




write to chatgpt.sh - do not forget your key!




#!/bin/sh
curl=`cat <<EOS
curl -sS --location --insecure --request POST 'https://api.openai.com/v1/chat/completions'
\
--header 'Authorization: Bearer <OPEN_AI_KEY>'
\
--header 'Content-Type: application/json'
\
--data-raw '{ …

ai authorization bash chatgpt linux terminal tutorial

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne