2
$\begingroup$

I had hoped to use the new LLM features in Mathematica 13.3. I requested an API key from OpenAI and gave it to Mathematica; the API key has never been used for anything else. Per OpenAI, it allows 3 requests per minute or 40,000 tokens per minute for GPT 3.5.

ServiceConnect["OpenAI"] connects but any request via ServiceExecute[openAI,…], or a ChatInput cell, or ChatQuery, or ChatSystemInput results in a "You have exceeded your current quote" error.

Is anybody able to get these features working?

$\endgroup$
1
  • $\begingroup$ Just tried everything everyone here recommended and still got the "...exceeded your current quota..." message with a never-before-used key. $\endgroup$
    – Rogo
    Aug 13, 2023 at 16:52

1 Answer 1

1
$\begingroup$

I only succeeded with a paid plan. You should first test to OpenAI exporting the OPENAI_API_KEY variable and test it with the following curl $ curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Say this is a test!"}], "temperature": 0.7 }'

If successful it will return the following and it will work in Mathematica

{
  "id": "chatcmpl-7lzRf746q3B2JWJ252bWTlkiJcYw5",
  "object": "chat.completion",
  "created": 1691671967,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This is a test!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 13,
    "completion_tokens": 5,
    "total_tokens": 18
  }
}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.