Search code examples
node.jsopenai-apigpt-3

OpenAI GPT-3 API error: "That model does not exist"


Get "That model does not exist" from api call in node.js

const chatGptUrl = "https://api.openai.com/v1/engines/chat-gpt/jobs";

...

const response = await axios.post(
      chatGptUrl,
      {
        prompt,
        max_tokens: 100,
        n: 1,
        stop: "",
      },
      {
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${chatGptApiKey}`,
        },
      }
    );

    const responseText = response.data.choices[0].text;

Solution

  • Problem

    You didn't set the model parameter. You have to set the model parameter to any OpenAI model that is compatible with the Completions API endpoint. It's a required parameter. See the official OpenAI documentation.

    Screenshot 1

    Solution

    Set the model parameter. You can choose between the following models:

    • gpt-3.5-turbo-instruct
    • babbage-002
    • davinci-002
    • text-davinci-003
    • text-curie-001
    • text-babbage-001
    • text-ada-001


    Also, all Engines endpoints are deprecated.

    Screenshot 2

    Use the Completions API endpoint.

    Change the URL from this...

    https://api.openai.com/v1/engines/chat-gpt/jobs
    

    ...to this.

    https://api.openai.com/v1/completions