Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -eq 0 ]; then
- echo "Usage: \$0 <query>"
- exit 1
- fi
- query="$1"
- OPENAI_API_KEY="your_openai_api_key_here"
- # Query with a model (models: gpt-4, gpt-4-0613, gpt-4-32k, gpt-4-32k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613)
- #curl -s -X POST https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d "{\"model\":\"gpt-4-0613\", \"messages\": [{\"role\":\"user\",\"content\":\"$query\"}]}"
- curl -s -X POST https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d "{\"model\":\"gpt-3.5-turbo-16k-0613\", \"messages\": [{\"role\":\"user\",\"content\":\"$query\"}]}"
- # Prompt for completion (models: text-davinci-003, text-davinci-002, text-curie-001, text-babbage-001, text-ada-001)
- #curl -s -X POST https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d "{\"model\":\"text-davinci-003\",\"prompt\":\"$query\"}"
- # Prompt for completion (max_tokens is optional)
- #curl -s -X POST https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d "{\"model\":\"text-davinci-003\",\"prompt\":\"$query\",\"max_tokens\": 2048}"
- # Engines are deprecated
- #curl -s -X POST https://api.openai.com/v1/engines/text-davinci-003/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d "{\"prompt\": \"$query\", \"max_tokens\": 2048}"
- # List of files
- # curl https://api.openai.com/v1/files -H "Authorization: Bearer $OPENAI_API_KEY"
- # List all available models
- # curl https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"
- # Retrieve basic information about a model
- # curl https://api.openai.com/v1/models/text-davinci-003 -H "Authorization: Bearer $OPENAI_API_KEY"
- # Edits (Given a prompt and an instruction, the model will return an edited version of the prompt, models: text-davinci-edit-001, code-davinci-edit-001)
- # curl -s -X POST https://api.openai.com/v1/edits -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{"model":"code-davinci-edit-001","input":"print(hello world in C++)", "instruction":"complete and fix the code"}'
- # More details at: https://platform.openai.com/docs/api-reference/edits
- # and: https://platform.openai.com/docs/models/gpt-3-5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement