- Регистрация
- 14.03.2022
- Сообщения
- 226
- Благодарностей
- 51
- Баллы
- 28
Есть вот такой код curl из openai:
Подскажите, как мне его преобразовать в запрос, чтобы я вставил его в URL и в переменную мне пришел ответ.
Пробовал вот так сделать:
Но в ответ мне приходит:
{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
Хотя АПИ ключ то верный....
Код:
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "You: What have you been up to?\nFriend: Watching old movies.\nYou: Did you watch anything interesting?\nFriend:",
"temperature": 0.5,
"max_tokens": 60,
"top_p": 1.0,
"frequency_penalty": 0.5,
"presence_penalty": 0.0,
"stop": ["You:"]
}'
Пробовал вот так сделать:
Но в ответ мне приходит:
{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
Хотя АПИ ключ то верный....