Mangoes
Mangoes

Reputation: 189

OpenAI API error: "The model `text-davinci-003` has been deprecated"

I was using the ChatGPT and it says to use this line of code for the API endpoint:

$endpoint = 'https://api.openai.com/v1/engines/text-davinci-003/completions';

But it doesn't work. I get the following error:

{ "error": { "message": "The model `text-davinci-003` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations", "type": "invalid_request_error", "param": null, "code": "model_not_found" } }

I can't really find anything to fix it.

I tried changing the models in the URL itself but it didn't work.

Upvotes: 18

Views: 46067

Answers (1)

Rok Benko
Rok Benko

Reputation: 23088

There are two problems with your code.

Problem 1: You're trying to use a deprecated OpenAI model

On January 4, 2024, OpenAI deprecated a lot of models.

See the deprecated models and recommended replacements in the tables below.

In your case, change text-davinci-003 for gpt-3.5-turbo-instruct.

Instruct GPT models

SHUTDOWN DATE LEGACY MODEL RECOMMENDED REPLACEMENT
2024-01-04 text-ada-001 gpt-3.5-turbo-instruct
2024-01-04 text-babbage-001 gpt-3.5-turbo-instruct
2024-01-04 text-curie-001 gpt-3.5-turbo-instruct
2024-01-04 text-davinci-001 gpt-3.5-turbo-instruct
2024-01-04 text-davinci-002 gpt-3.5-turbo-instruct
2024-01-04 text-davinci-003 gpt-3.5-turbo-instruct

Base GPT models

SHUTDOWN DATE LEGACY MODEL RECOMMENDED REPLACEMENT
2024-01-04 ada babbage-002
2024-01-04 babbage babbage-002
2024-01-04 curie davinci-002
2024-01-04 davinci davinci-002
2024-01-04 code-davinci-002 gpt-3.5-turbo-instruct

Fine-tuning GPT models

SHUTDOWN DATE LEGACY MODEL RECOMMENDED REPLACEMENT
2024-01-04 ada babbage-002
2024-01-04 babbage babbage-002
2024-01-04 curie davinci-002
2024-01-04 davinci davinci-002, gpt-3.5-turbo, gpt-4

Edit models

SHUTDOWN DATE MODEL RECOMMENDED REPLACEMENT
2024-01-04 text-davinci-edit-001 gpt-4
2024-01-04 code-davinci-edit-001 gpt-4

Embedding models

SHUTDOWN DATE LEGACY MODEL RECOMMENDED REPLACEMENT
2024-01-04 text-similarity-ada-001 text-embedding-ada-002
2024-01-04 text-search-ada-doc-001 text-embedding-ada-002
2024-01-04 text-search-ada-query-001 text-embedding-ada-002
2024-01-04 code-search-ada-code-001 text-embedding-ada-002
2024-01-04 code-search-ada-text-001 text-embedding-ada-002
2024-01-04 text-similarity-babbage-001 text-embedding-ada-002
2024-01-04 text-search-babbage-doc-001 text-embedding-ada-002
2024-01-04 text-search-babbage-query-001 text-embedding-ada-002
2024-01-04 code-search-babbage-code-001 text-embedding-ada-002
2024-01-04 code-search-babbage-text-001 text-embedding-ada-002
2024-01-04 text-similarity-curie-001 text-embedding-ada-002
2024-01-04 text-search-curie-doc-001 text-embedding-ada-002
2024-01-04 text-search-curie-query-001 text-embedding-ada-002
2024-01-04 text-similarity-davinci-001 text-embedding-ada-002
2024-01-04 text-search-davinci-doc-001 text-embedding-ada-002
2024-01-04 text-search-davinci-query-001 text-embedding-ada-002

Problem 2: You're trying to use a deprecated OpenAI API endpoint

All Engines API endpoints were deprecated a very, very long time ago.

Change this...

https://api.openai.com/v1/engines/text-davinci-003/completions

...to this.

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

Upvotes: 35

Related Questions