Getting Started With OpenAI ChatGPT (GPT-3.5) API In Python | Tutorial For Beginners



OpenAI has finally released the most anticipated ChatGPT model today, called “gpt-3.5-turbo”. Unlike the GPT 3.0 models that work like a search engine, ChatGPT model tracks the conversation to create more useful outputs. In this tutorial, I will go through every single detail on how to get started with the newest OpenAI ChatGPT API in Python.

📑 Python Script Used In The Video: https://wp.me/payCAw-1lw

💻 Build Your Own ChatGPT Desktop App: https://youtu.be/snkys9zXyD0

✉ Signup for an OpenAI account: https://openai.com/

📑 OpenAI GPT Model Pricing: https://openai.com/pricing

📑 openai.ChatCompletion reference: https://platform.openai.com/docs/guides/chat

📑 OpenAI ChatGPT Model (gpt3.5 turbo) Info : https://platform.openai.com/docs/models/gpt-3-5

► Buy Me a Coffee? Your support is much appreciated!
——————————————————————————————-
☕ Paypal: https://www.paypal.me/jiejenn/5
☕ Venmo: @Jie-Jenn
💸 Join Robinhood with my link and we’ll both get a free stock: https://bit.ly/3iWr7LC

► Support my channel so I can continue making free contents
—————————————————————————————————————
🛒 By shopping on Amazon → https://amzn.to/2JkGeMD
👩‍💻 Follow me on Linked: https://www.linkedin.com/in/jiejenn/
🌳 Becoming a Patreon supporter: https://www.patreon.com/JieJenn
✉️ Business Inquiring: [email protected]

00:00 – Intro to OpenAI gpt 3.5 turbo model
00:34 – OpenAI GPT-3.5 Pricing difference vs GPT-3.0
01:51 – OpenAI GPT 3.5 models summary
03:03 – Sign up for an OpenAI account
03:29 – Create an OpenAI API Key
03:47 – Create Python script
04:15 – Install OpenAI Python package
04:27 – open.ChatCompletion library usage
11:00 – Track ChatGPT conversation
15:03 – Make the Python script runs like ChatGPT

#chatgpt #chatgptapi #openai #ai #python #gpt

21 comments
  1. 📑 Source Code: https://wp.me/payCAw-1lw

    I will be releasing more chatGPT related videos in the future, so don't forget to subscribe!

    PS: I was incorrect regarding you cannot set a token limit with ChatCompletion model. In fact you can, by setting the "max_tokens" parameter.

  2. Thanks Jenn it works am using Pycharm. Does token have limitation? Bcoz i want to summarize abt 50,000 words. So how do i increase the token or bypass limitation?

  3. Today was my first day of using python and i already made a discord bot that reads messages from a specified channel, sends those messages to chat gpt, and then sends chat gpt's response back to the original channel(i know it isn't much but it's my first day come on).

  4. HI,thanks your shareing. When I follow your step and block in 9:30 . The fuction show : openai.error.InvalidRequestError: Invalid URL (POST /v1/chat/completions). I fond the solution to this problem is to change the model to engine, but it still not work. Could you help me ? This block me 2 days.

  5. Hi. I got my key, and used pip to install openai, but when I type import (in PyCharm) "openai" doesn't show up in autocomplete, and I get a run error saying "No module named 'openai'". Any tips on why that might be?

  6. Hi, I'm successfully run your script in terminal!
    however, i want to export the output, so can you maybe make another video tutorial how to use this on web browser, or maybe a gui app with parameters setting? thank you!

  7. I just finished building a python code that totally interactive without typing or reading text. you can use an local wakeup word(stays offline until you want to use it). then wakes up and uses ChatGPT-3.5-turbo. It remembers the previous conversations, you talk to it, and it answers back with speech. I want to add it to an interactive AI avatar if anyone can help with that. uses wireless microphone so I don't even need to be by the computer.

  8. Thank you so much! But I got his problem :"openai.error.InvalidRequestError: Additional properties are not allowed ('content:' was unexpected) – 'messages.2", could you tell me what would be the problem? Thanks a lot!

  9. Much appreciation, I decided to learn VS Code and Python (basics) a couple days ago so I could start playing with this API. Last time I cracked open any code was probably VBA (if you can call that code) Appreciate you taking the time to explain your process and some of the underlying pieces.

    Update – your code worked perfectly and I know that: In the 2020 NBA Finals, 575 free throws were attempted by both teams combined over the 6 games. Thanks a ton!

  10. "system" is supposed to instruct the model, send it before "user" message, no need to send it as an individual request.

  11. Is there anything special you need to do to get this to run just using "run pythin file"? If I run the whole code as a block it works but all hell breaks loose if I try to just click the |> button.

Comments are closed.