Was using a Pay as you go with enough Credit balance. I am getting :“Incorrect API key provided” error, i am using command promt with Curl (with i got through Git).
curl https://api.openai.com/v1/audio/speech ^
-H "Authorization: Bearer <sk-7********************************************o>" ^
-H "Content-Type: application/json" ^
-d "{""model"": ""<tts-1>"", ""input"": ""<[Vietnamese]Hãy cùng các thầy cô khám phá Mục tiêu Phát triển Bền vững (SDGs) và truyền cảm hứng để các bạn học sinh của chúng ta trở thành thế hệ tiên phong cho sự thay đổi ngay hôm nay!.>"", ""voice"": ""<Fable>"", ""speed"": <1.0>}" ^
--output <OpenAI-TTS-Fable>.mp3
the result are:“Incorrect API key provided” along with: “The system cannot find the file specified”.
I got the code snippet from a link given by my superior, i will try again with your fix, thank you very much. Also it’s a Pay as you go account without chatGPT4 subscription, does that effect the outcome?
“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.”
Sorry for the barrage of question, and hoppefully this will result it.
You need to replace that with the API key, either by setting the value OPENAI_API_KEY as an environment variable in your system, or hard-coding the actual text of the key into the script (which you then must keep secure):
uh uhm… if by that you mean replace $OPENAI_API_KEY with my actual API key then yes i did, i even revoked the old one and got a new one (i don’t think i used the old one by accident), i didn’t even change anything this time other than “$OPENAI_API_KEY” to my API to see if it work and the result are still:
“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.”
but thank you for the answer.
Are you enclosing it in the greater-than sign like in your first post now edited? That is wrong. It is just the bare string.
Also, I don’t know why you’re using double quotes as escape when you can just quote with single quotes. You would normally have a variable as input, so don’t need to worry about the characters within.