MacPaw / OpenAI

Swift community driven package for OpenAI public API
MIT License
2.11k stars 357 forks source link

Incorrect API key provided #201

Open AlYehorov opened 7 months ago

AlYehorov commented 7 months ago

Hello guys, I have faced with issue that's my API key incorrect. I've tried to create a new one but still have the same problem. Previously everything was ok. I have money on my OpenAI acc so it's not related to an empty balance or something like that.

Any idea why I have it ?

APIErrorResponse(error: OpenAI.APIError(message: "Incorrect API key provided: \"sk-proj**\". You can find your API key at https://platform.openai.com/account/api-keys.", type: "invalid_request_error", param: nil, code: Optional("invalid_api_key")))

OpenAI 0.2.6 version (SPM package)

ThatGuySam commented 6 months ago

OpenAI recently rolled out per project API keys with the following format:

sk-proj-abcdefghijklmnopqrstuvwxyz1234567890abcdef

Although this article doesn't seem to mention this specific format change you can read about it here: https://help.openai.com/en/articles/9186755-managing-your-work-in-the-api-platform-with-projects

You might be able to create a your own Project API key to verify here: https://platform.openai.com/api-keys

This library likely does a format check to confirm that the key is the expected classic key format so that the user didn't accidentally type or paste the wrong text somehow.

sk-abcdefghijklmnopqrstuvwxyz1234567890abcdef
AlYehorov commented 6 months ago

OpenAI recently rolled out per project API keys with the following format:


sk-proj-abcdefghijklmnopqrstuvwxyz1234567890abcdef

Although this article doesn't seem to mention this specific format change you can read about it here:

https://help.openai.com/en/articles/9186755-managing-your-work-in-the-api-platform-with-projects

You might be able to create a your own Project API key to verify here:

https://platform.openai.com/api-keys

This library likely does a format check to confirm that the key is the expected classic key format so that the user didn't accidentally type or paste the wrong text somehow.


sk-abcdefghijklmnopqrstuvwxyz1234567890abcdef

I know that, even with new key (project key) it does not work. That's why I'm asking here about that)

vkix-7 commented 6 months ago

Hey bro can u provide me open ai api key for testing out a project u can deactivate after 1 hour plzz my credits are already expired help me out