API openai.ChatCompletion error

When i use “openai.Completion.create” , there no problem, all run good. But when i want to use openai.ChatCompletion.create there a error : AttributeError: module ‘openai’ has no attribute ‘ChatCompletion’

I want to use gpt-3.5-turbo and i need ChatCompletion . What can i do ?

Welcome to the forums.

Step 1… Read rules of the community.
Step 2… Search forums for similar topics…


Step 3… ???
Step 4… Profit!

In all seriousness, you likely need to update your openai module… without more details, it’s hard to help you…

Hope this helps.

1 Like

This post was flagged by the community and is temporarily hidden.

You should post your code which you use to call the OpenAI API chatcompletion method so we can help you.

Post code and data here using Markdown using triple backticks like this:

# your property formatted and indented code and data here


I found the problem, uninstalled openai (-pip uninstall openai) and reinstalled. I had an older version. Now everything is ok, thank you!

1 Like