This commit is contained in:
Zheng Kai
2023-08-21 10:49:03 +08:00
parent 866b2f569c
commit 911c1b9f5f
6 changed files with 26 additions and 22 deletions
+7 -6
View File
@@ -3,9 +3,10 @@
BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}"
curl -v "${BASE}/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Hello!"}]
}'
-w "Total time: %{time_total} seconds\n" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Hello!"}]
}'
+9 -8
View File
@@ -2,11 +2,12 @@
BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}"
curl "${BASE}/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{
"model": "text-davinci-003",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0
}'
-w "Total time: %{time_total} seconds\n" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{
"model": "text-davinci-003",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0
}'
+3 -2
View File
@@ -2,5 +2,6 @@
OPENAI_API_KEY="sk-rhjeVT1fkcuarBKnQR6ST$(cat ~/.config/openai)"
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer ${OPENAI_API_KEY}"
curl -s https://api.openai.com/v1/models \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
| jq . -
+4 -4
View File
@@ -3,7 +3,7 @@
BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}"
curl -v "${BASE}/moderations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{"input": "你媽逼啊"}' \
| jq . -
-w "Total time: %{time_total} seconds\n" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-d '{"input": "你媽逼啊"}'