Trying to use gpt-3.5-turbo instead of da-vinci


I have been trying to use Open AI APIs for text classification. From the playground, I am only able to get text-davinci-003 for completion but the result from this API are no where close to the chatGPT bot ( website). So I am trying to switch the model to gpt-3.5-turbo in the below code. But I get this error: InvalidRequestError: This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?

Any guidance on how to use gpt-3.5-turbo? Basically, I want to replicate the chatGPT bot through API calls.

response = openai.Completion.create(
  prompt= prompt,


same here would be great to use the turbo model on the completion api.

Yes, sure.

Go to the main OpenAI API reference page:

In your browser search bar, paste this:

Create chat completion

Then read the API does for the chat completion and it’s easy.

It is important to read the docs.



Here’s sample code of my sentiment analysis function.

def sentiment_analysis(text):
    MODEL = "gpt-3.5-turbo"
    response = openai.ChatCompletion.create(
        model = MODEL,
        {"role": "system", "content": "You are performing text analysis."},
        {"role": "user", "content": "YOUR PROMPT GOES HERE: " + text},
        temperature = 0,    
        max_tokens = 250,
    message = response["choices"][0]["message"]["content"].strip().lower().translate(str.maketrans('', '', string.punctuation))
    sentiment = None
    if "yes" in message:
        sentiment = "1"
    elif "no" in message:
        sentiment = "2"
        sentiment = "0"
    return sentiment  

This has essentially been my replacement to move over from the engine system, and functions essentially identically.

try to change end point to:


This is the reference link OpenAI API

1 Like

Thanks. There were two issues at my end:

  1. Was using Completion instead of ChatCompletion
  2. ChatCompletion wasnt working for me as I was an earlier version of openai package. Updating it fixed the issues.


@databeings that worked for me.
Also useful to note that for NodeJS the method is createChatCompletion.

And the parameters of the function have changed as per the api documentation and introduction guide.

Most notably is that it no longer uses prompt but instead messages which have a specific “chat format”.