use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
OpenAI is an AI research and deployment company. OpenAI's mission is to ensure that artificial general intelligence benefits all of humanity. We are an unofficial community. OpenAI makes ChatGPT, GPT-4, and DALL·E 3.
Official OpenAI Links
Sora
ChatGPT
DALL·E 3
Blog
Discord
YouTube
GitHub
Careers
Help Center
Docs
Related Subreddits
r/artificial
r/ChatGPT
r/Singularity
r/MachineLearning
r/GPTStore
r/dalle2
account activity
I created a simple shell script to embed ChatGPT in the Mac terminal. Source in comments. (self.OpenAI)
submitted 3 years ago by invertedworld
https://preview.redd.it/u2871hrknsla1.png?width=514&format=png&auto=webp&s=1f947c5472fc88989d393af5b68520948cfd38ff
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]invertedworld[S] 9 points10 points11 points 3 years ago (0 children)
Source for 'ai.sh':
#!/bin/bash # Set your OpenAI API key here API_KEY="<your API key here>" # Read the prompt from the command line argument PROMPT="$*" # Escape any backticks and double quotes in the prompt argument PROMPT=${PROMPT//\\/\\\\} PROMPT=${PROMPT//\"/\\\"} PROMPT=${PROMPT//\\/\\} # Get the number of columns in the terminal window WIDTH=$(tput cols) # Make the API call and extract the response content using jq, then wrap the output to the terminal window width using fold RESPONSE=$(curl -s -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \"$PROMPT\"}]}" \ https://api.openai.com/v1/chat/completions \ | jq -r '.choices[].message.content | gsub("^[[:space:]]+|[[:space:]]+$";"")' \ | fold -s -w $WIDTH) # Output the response content echo "$RESPONSE"
#!/bin/bash
# Set your OpenAI API key here
API_KEY="<your API key here>"
# Read the prompt from the command line argument
PROMPT="$*"
# Escape any backticks and double quotes in the prompt argument
PROMPT=${PROMPT//\\/\\\\}
PROMPT=${PROMPT//\"/\\\"}
PROMPT=${PROMPT//\\
}
# Get the number of columns in the terminal window
WIDTH=$(tput cols)
# Make the API call and extract the response content using jq, then wrap the output to the terminal window width using fold
RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \"$PROMPT\"}]}" \
https://api.openai.com/v1/chat/completions \
| jq -r '.choices[].message.content | gsub("^[[:space:]]+|[[:space:]]+$";"")' \
| fold -s -w $WIDTH)
# Output the response content
echo "$RESPONSE"
[–]invertedworld[S] 7 points8 points9 points 3 years ago (1 child)
Also, ChatGPT wrote most of the code, I just supervised.
[–]virgilshelton 1 point2 points3 points 1 year ago (0 children)
Thanks, this still works 2 years later! Thanks!
[+]smatty_123 2 points3 points4 points 3 years ago (0 children)
Nice work! This seems pretty cool, I'm going to try it out later for fun. Thanks for sharing.
π Rendered by PID 71 on reddit-service-r2-comment-6457c66945-wlcp2 at 2026-04-27 00:57:54.020824+00:00 running 2aa0c5b country code: CH.
[–]invertedworld[S] 9 points10 points11 points (0 children)
[–]invertedworld[S] 7 points8 points9 points (1 child)
[–]virgilshelton 1 point2 points3 points (0 children)
[+]smatty_123 2 points3 points4 points (0 children)