Message Boards Message Boards

OpenAI API Key does not work

I have established a paid account with OpenAI, obtained a secret API Key, run the packlet to show ChatEnabled Notebook in Mathematica, Followed the instructions here https://support.wolfram.com/62525?src=mathematica which do not work; Then found the "openAI=ServiceConnect["OpenAI"] code which produced the Authentication box, entered my secret key. I still get an error message as if I had never done any of it. Is there a delay between establishing a paid acct with Open AI and the key being authorized?

POSTED BY: Roger J Brown
14 Replies
Posted 9 months ago

You need to make sure you have a credit balance enter image description here

POSTED BY: Nickarino Skri

Hi,

How were you able to get around the issue by directly evaluating the following code:

Needs["ChristopherWolfram`OpenAILink`"]
PacletSymbol["ChristopherWolfram/OpenAILink", 
   "ChristopherWolfram`OpenAILink`$OpenAIKey"] = "<myAPIKey>";

Set::write: Tag PacletSymbol in PacletSymbol[ChristopherWolfram/OpenAILink,ChristopherWolfram`OpenAILink`$OpenAIKey] is Protected.

Even if i use the following line to change my API Key:

SystemCredential["OpenAIKey"] = <"MY_API_KEY">

it keeps using my old API Key.

Thanks for your help.

POSTED BY: Ghassane Aniba

Try

ServiceConnect["OpenAI", "New"]
POSTED BY: Rohit Namjoshi

Update: I retried tonight and it worked. I used also 'Unset[SystemCredential["OpenAIKey"]]' to remove the key and submit the new one.

I used all options to setup the new OpenAI Key including the one you provided but still same result, the key won't change and keeps the same old key. Is there a file where the key is stored so i can edit it? I really can't find anyway to do it. Thanks for your reply.

POSTED BY: Ghassane Aniba
Posted 1 year ago

yes I see that my post was unclear; apologies. The code I evaluated was simply

$OpenAIKey = "<myAPIKey>";

but I can't test anymore as I've run out of API credits on OpenAI and they expire really quickly without my getting much value from them when I do buy them.

POSTED BY: Updating Name

I have a similar problem, perhaps this is a duplicate but I didn't find any other discussions around this problem.
I've successfully installed the Paclet but found it hard to get off the starting block:

Needs["ChristopherWolfram`OpenAILink`"]
PacletSymbol["ChristopherWolfram/OpenAILink", 
   "ChristopherWolfram`OpenAILink`$OpenAIKey"] = "<myAPIKey>";

Set::write: Tag PacletSymbol in PacletSymbol[ChristopherWolfram/OpenAILink,ChristopherWolfram`OpenAILink`$OpenAIKey] is Protected.

that error message may be hard to see but is says the Tag is Protected. $OpenAIKey = "<myAPIKey>";

However, I was able to get around the issue by directly evaluating the above code.

This is how I have set it up in the past:

  1. Goto the OpenAI web site and click the "Log In" button in the top right
  2. Click on the "API" panel and log in
  3. Click the top right user menu and select 'View API keys" from the pull down
  4. Click on "Create a new secret key"
  5. Create the key and store it somewhere safe on your computer
  6. In a notebook, evaluate this code to set the API persistently in the Wolfram Language:

    SystemCredential["OPENAI_API_KEY"] = "your-key-here"
    
POSTED BY: Arnoud Buzing

Arnoud - Correct and that is what I did. It assumes OpenAI is working properly. They admit it is not, at least in the API_Key issuing department. Makes you wonder what else is wrong. But, after all, there must be SOMETHING wrong or it would not be ARTIFICIAL intelligence!!!

I am on hold with OpenAI Support. Wish me luck

POSTED BY: Roger J Brown

Good luck!

A simple(r) way to test this OpenAI with the LLMSynthesize function, so doing something like:

LLMSynthesize["hello there"]
POSTED BY: Arnoud Buzing

Agreed But, to use the built-in v. 13.3 features, one needs an API_KEY so the acronym "API", confusingly appears in both contexts. Still learning about this new stuff...

POSTED BY: Roger J Brown

Apparently this is a known problem. The API KEY I am being issued is coming from my free account, not the one I paid for. There "Chat" system says I should have an answer within a week!!!

From OpenAI

POSTED BY: Roger J Brown

Using v. 13.3 Error message attached

Attachment

Attachments:
POSTED BY: Roger J Brown

Roger,

The ChatGPT Plus subscription does not include API access. From this link:

Please note that the ChatGPT API is not included in the ChatGPT Plus subscription and are billed separately. The API has its own pricing, which can be found at https://openai.com/pricing. The ChatGPT Plus subscription covers usage on chat.openai.com only and costs $20/month.

POSTED BY: Rohit Namjoshi

What is the error message? What version of Mathematica are you running?

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract