ハピタス登録で1,000円分になるURL
ChatGPTはコードまで書いてくれる
末おそろしい。
#!/bin/bash
# Set up your API key
export OPENAI_API_KEY="your_api_key"
# Define the prompt for the model
prompt="What is the meaning of life?"
# Use curl to make a POST request to the OpenAI API
response=$(curl -s -X POST -H "Content-Type: application/json" -d "{\"prompt\":\"$prompt\"}" "https://api.openai.com/v1/engines/davinci/completions")
# Extract the generated text from the response
generated_text=$(echo "$response" | jq -r '.choices[0].text')
# Print the generated text
echo "$generated_text"