How to use the ChatGPT API with Python!!

Ғылым және технология

Get notified of the free Python course on the home page at www.coursesfromnick.com
Sign up for the Full Stack course here and use KZread50 to get 50% off:
www.coursesfromnick.com/bundl...
Code: github.com/nicknochnack/ChatG...
Hopefully you enjoyed this video.
💼 Find AWESOME ML Jobs: www.jobsfromnick.com
Oh, and don't forget to connect with me!
LinkedIn: bit.ly/324Epgo
Facebook: bit.ly/3mB1sZD
GitHub: bit.ly/3mDJllD
Patreon: bit.ly/2OCn3UW
Join the Discussion on Discord: bit.ly/3dQiZsV
Happy coding!
Nick
P.s. Let me know how you go and drop a comment if you need a hand!
#machinelearning #python #datascience

Пікірлер: 163

  • @generichuman_
    @generichuman_ Жыл бұрын

    One thing that's nice to add is streaming, so that the words show up as they are being generated. This avoids the longer wait times for lengthy responses. Also, I've noticed that openai is still working out the kinks with their api's and some days you'll get a pretty high failure rate and have to retry a response. With streaming, you can set a reasonable timeout to try again ( usually if the first word hasn't arrived within 3 seconds, it's going to fail and hang indefinitely). If you don't have streaming, you have to wait as long as your longest possible response to retry which could be more than 10 seconds in some cases. Getting into the minutiae a little bit, but just some things I've discovered in my travels.

  • @pratikbawane997

    @pratikbawane997

    Жыл бұрын

    Hi there! Can you tell me how to add streaming as you said above?!

  • @Ultimate-pb8hl

    @Ultimate-pb8hl

    10 ай бұрын

    does this include getting responses like "permissions denied"?

  • @ULTRA5364

    @ULTRA5364

    5 ай бұрын

    Awesome!

  • @KSATica
    @KSATica Жыл бұрын

    ChatGPT has been AMAZING the experience for me was priceless

  • @rayaneghilene5152
    @rayaneghilene5152 Жыл бұрын

    You re a lifesaver, I’ll be using it for my school project thanks 🙌

  • @n-0-1
    @n-0-1 Жыл бұрын

    I'm scraping all of the chat and teams log data from my company and training gpt with it. I will build a UI for my team members so that our private technical business questions that are asked frequently can be answered quickly.

  • @borntodoit8744

    @borntodoit8744

    2 ай бұрын

    I wish you would add more data.. how u implemented usecase: training using private data for private AI requires an instance of a model workflow: prompt + private data >chatbot >model (GPT LLM) >completion unless u have a local instance of model (GPT LLM) then your data is still going to the internet (to OpenAi 's GPT instance)... feb2024: your post is 10 months old (2023) I don't think running local model instances (llama, Gemini, GPT) were available to download & install locally

  • @eliedabelly3804
    @eliedabelly3804 Жыл бұрын

    I love how these videos - so short and direct it makes it so much simpler to follow thank you 🙏

  • @borntodoit8744

    @borntodoit8744

    Жыл бұрын

    Is called dumbing it down for the masses. everyone thinks they are an expert till they hit a basic problem...

  • @Fghhhg8883
    @Fghhhg8883 Жыл бұрын

    Thank's for letting us know that openAI have released API for chatGPT. I wonder how many of my students already have a account

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Anytime @Yrgen! Got some plans to do more content around it!

  • @RaviKant-ll6ck

    @RaviKant-ll6ck

    8 ай бұрын

    Turnitin will catch the content generated by AI.

  • @Eric-demonic_saint
    @Eric-demonic_saint Жыл бұрын

    Awesome 😎 Thank you for sharing with us❤

  • @pavankumarsettem1834
    @pavankumarsettem1834 Жыл бұрын

    Thank's for that. Can you make a video on explainability in ML models, I want to know why and how the models work.

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    You got it!

  • @settempavan9744

    @settempavan9744

    Жыл бұрын

    Can you make a video on explainability in ML models such as visualisation techniques in CNN and more

  • @ozgurgulerx
    @ozgurgulerx Жыл бұрын

    Hey Nicolas, enjoying your content! You are an inspiration! Just curious which final cut effect plugins you use? They make videos quiet enjoyable.

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    No plugins anymore, I do all the special effects in Adobe After Effects. Occasionally I use DeepGlow but all the custom stuff you see here is from AE

  • @big_bits
    @big_bits Жыл бұрын

    How does this work with continuity between messages?

  • @vikashmaurya2679

    @vikashmaurya2679

    11 ай бұрын

    You need to store it, you can store it temporarily in a list and that way you can maintain continuity

  • @NicholasRenotte
    @NicholasRenotte Жыл бұрын

    Damn 😅 Gotta work out better placement for the keyboard cam.

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Also, lmk if any of you are coming to the forum I mentioned on LinkedIn! Would love to grab coffee with y'all!!

  • @ahmadelmassalkhi

    @ahmadelmassalkhi

    6 ай бұрын

    i dont get the .ChatCompletion method i get .completion

  • @DarrenTarmey
    @DarrenTarmey Жыл бұрын

    How does the results compaire to use gui connected to API or using the web app or in browser

  • @anshulbisht1350
    @anshulbisht13504 ай бұрын

    How many such requests can be made? Is there some limits in your plus subscription?

  • @user-ll3xd5dy3f
    @user-ll3xd5dy3f6 ай бұрын

    What dependencies do I have to install before running this code?

  • @jhemp8446
    @jhemp8446 Жыл бұрын

    I’ve been doing a lot of cool stuff with the API. It’s incredibly easy to implement and find new ways to work with other libraries

  • @BigBoss-sm9xj

    @BigBoss-sm9xj

    Жыл бұрын

    Do you think it's worth the price?

  • @jhemp8446

    @jhemp8446

    Жыл бұрын

    @@BigBoss-sm9xj a better question to ask, does it pay for itself and the answer is yes.

  • @ninefour11
    @ninefour1111 ай бұрын

    is this script working without openai api key?

  • @CoconutPete
    @CoconutPete Жыл бұрын

    I'd like to see a simple example with PHP. I tried a month ago it never worked

  • @Compguy321
    @Compguy3215 ай бұрын

    Can you share how to get just the output, and not the rest of the object?

  • @soccerfooty2012
    @soccerfooty20123 ай бұрын

    What is the benefit of using this instead of the default chat gpt webiste?

  • @akhilprazapati6148
    @akhilprazapati614810 ай бұрын

    Any full screen video for this please... Or any other source for this...

  • @MG-ih6po
    @MG-ih6po Жыл бұрын

    for the content, to make it more dynamic, have the user supply the prompt as a command line argument.

  • @borntodoit8744

    @borntodoit8744

    Жыл бұрын

    is a programmatic example to show the open api not to show a scripting example for other usecases

  • @PassingTheDog
    @PassingTheDog Жыл бұрын

    Nice one Nicholas. One question, there's the same max characters in the output as in the web version? In this format of video seems longer.

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    What's the limit in the web version? It generated a whole page for me this morning!

  • @PassingTheDog

    @PassingTheDog

    Жыл бұрын

    @@NicholasRenotte It was like 4k characters. But I guess that now with the paid version it depends of the budget :')

  • @ko-Daegu

    @ko-Daegu

    Жыл бұрын

    That’s has to do with the mode 4k token is the gpt4 limit (I heard they will release a 32k token limit )

  • @thespringer4257
    @thespringer425710 ай бұрын

    It's using GPT3.5 turbo, how do you use GPT4 instead?

  • @izaanmohammed3589
    @izaanmohammed35896 ай бұрын

    Do we need a chatgpt acount

  • @binodmalaka4508
    @binodmalaka450811 ай бұрын

    Thanks mate 🤍

  • @noviccen388
    @noviccen388 Жыл бұрын

    how much the pricing?

  • @TerryLewisVideos
    @TerryLewisVideos Жыл бұрын

    Nice, thanks.

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Cheers Terry!

  • @gianmarcoguarnier2525
    @gianmarcoguarnier2525 Жыл бұрын

    hey Nick, I’ve been trying to build a chatbot using the official API but the engine don’t have memory. Is there a way to have such thing with the official api? Right now i m using the un official chatgpt wrapper but I need to login every time

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Hmmm not too sure where the memory issue is? On ChatGPTs side or for your app? I'm doing a walkthrough of how to integrate it into Watson Assistant today. Started working on the Openapi spec yesterday. Should be out soon, I've been getting a ton of questions on it.

  • @gianmarcoguarnier2525

    @gianmarcoguarnier2525

    Жыл бұрын

    @@NicholasRenotte Like: you can use the engine to generate answers as you showed but you can't generate a conversation instance through the API. Or can you? Looking foward for the video!

  • @jenniarlet13
    @jenniarlet135 ай бұрын

    How can I feed it data to build a custom trained model ?

  • @ULTRA5364

    @ULTRA5364

    5 ай бұрын

    That's a good question!

  • @ahmedmeftah731
    @ahmedmeftah731 Жыл бұрын

    you can litterly make an ai app that just runs chatgpt

  • @ahmedmeftah731

    @ahmedmeftah731

    7 ай бұрын

    @noobody. no no, I mean an interface that works via ChatGPT-API

  • @cheaterflex3532
    @cheaterflex3532 Жыл бұрын

    This good content

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Thanks a mil @jasser!!

  • @jerbky
    @jerbky Жыл бұрын

    Hey nic can you do a stock market (of your choice) data analysis

  • @erickmacias5153
    @erickmacias5153 Жыл бұрын

    Can you make videos about fine tunning, and semantic search using gpt?🥺

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    You got it!

  • @harshlakhani4171
    @harshlakhani4171 Жыл бұрын

    Is there a way to use ChatGPT 4 on this?

  • @mukithasan9684
    @mukithasan96843 ай бұрын

    Is there anyway to get an api for free use for learning ?

  • @saishireesha2588
    @saishireesha25883 ай бұрын

    Nice vlog ❣️Kannayya while seeing in mobile be like Enti nenu intha cute ga vunna 😊😅

  • @circuitcoder
    @circuitcoder Жыл бұрын

    Wait, I think this is actually pretty useful... * looks at Alexa echo dot * hehehehehe

  • @circuitcoder

    @circuitcoder

    Жыл бұрын

    For those who didn't get it, I want to try to make an Alexa skill which let's you communicate with chat gpt through Alexa

  • @curesnow6493
    @curesnow64934 ай бұрын

    Is it free to use open ai APIs?

  • @CoBER-nc3el
    @CoBER-nc3el Жыл бұрын

    Hi there. Is it possible you could tell me if paying for the api key gives faster response times... for chatgpt api? Would appreciate your response.

  • @naitikjain9292

    @naitikjain9292

    Жыл бұрын

    I think you cannot use this without paying, not sure tho

  • @trisha8066
    @trisha8066 Жыл бұрын

    I am trying to install openai to my file in visual studio code but its not working what do i do

  • @flexhshadow1990
    @flexhshadow1990 Жыл бұрын

    So I've made a tkinter app that had a prompt box and returns in a canvas with a save as need to clean it up need to learn to style more

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Nice!! Awesome Josh!

  • @gutsjoestar7450
    @gutsjoestar7450 Жыл бұрын

    what is the purpose of asking chatgpt questions in vscode

  • @nathanb2984
    @nathanb2984 Жыл бұрын

    How about image detection for onscreen images and algo? 😅😂

  • @yusuffbb
    @yusuffbb Жыл бұрын

    Hello. I installed that module but apikey methods not included. This way of codes gives me error. ModuleNotFoundError: No module named 'apikey' Do you have any suggestion?

  • @karim7658

    @karim7658

    Жыл бұрын

    It's a local module he created himself to store his APIKEY I believe.

  • @omar7613
    @omar7613 Жыл бұрын

    AWESOME

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Cheers Omar!

  • @omar7613

    @omar7613

    Жыл бұрын

    Bro! I wanna learn Reinforcement Learning, are your old videos still working? I heard that the libraries changed and the code doesn’t work from the comments.

  • @NicoleSummer8
    @NicoleSummer85 ай бұрын

    Awesome ❤👍💪👏😄

  • @youtubercell9112
    @youtubercell91127 ай бұрын

    Would have to pay tho?

  • @johnabe1730
    @johnabe17302 ай бұрын

    Do we need to generate a key from the open Ai website?

  • @Harsh-nv3xw

    @Harsh-nv3xw

    15 күн бұрын

    yes

  • @janarthanan1716
    @janarthanan1716Ай бұрын

    Bro how to buy api keys in open ai

  • @tejastidake6897
    @tejastidake68978 ай бұрын

    Is the API free?

  • @user-ej3oe2cx6k
    @user-ej3oe2cx6k Жыл бұрын

    Can I make chatgpt helps me in prediction and classification with me model and links it with opencv I mean can I let the mission for chatgpt

  • @manav-khadka
    @manav-khadka Жыл бұрын

    hey nicholas please made video on kaggle

  • @youssefultr
    @youssefultr11 ай бұрын

    it says You exceeded your current quota, please check your plan and billing details you are so lucky you got it for free man

  • @asmaamohamedmagdhelali5610

    @asmaamohamedmagdhelali5610

    2 ай бұрын

    Me too

  • @stutitomar6230

    @stutitomar6230

    Ай бұрын

    What did you do next?

  • @JassyMon-wn4eh
    @JassyMon-wn4eh3 ай бұрын

    Can you pls do the same for llama 2

  • @kayodeolanrewaju5459
    @kayodeolanrewaju5459 Жыл бұрын

    would you need internet connection before it generates the output or it does it like that

  • @mayanksharma6622
    @mayanksharma66228 ай бұрын

    Will it give me the gpt4 answers?

  • @CDWRR
    @CDWRR4 ай бұрын

    ChatCompletion line is not working properly

  • @miname.1802
    @miname.1802 Жыл бұрын

    this scares me a lot Nick

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Curious? Why so @Mi Name?

  • @abetterfuture4787
    @abetterfuture4787 Жыл бұрын

    "Cannot import name APIKEY from apikey" O________O I did pip install apikey and it went through, but the code still doesn't run. What gives?

  • @luischronos

    @luischronos

    Жыл бұрын

    bruh...

  • @abetterfuture4787

    @abetterfuture4787

    Жыл бұрын

    @@luischronos Help a newb out?

  • @aadityasahoo6244
    @aadityasahoo6244 Жыл бұрын

    hey, im continuously getting this error openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details even though its a brand new key and i used the old key way back in feb can someone please help, thanks :D

  • @unknownyoutuber8

    @unknownyoutuber8

    11 ай бұрын

    I am getting the same problem

  • @CAGonRiv
    @CAGonRiv Жыл бұрын

    Eerie how time and time again that we align our projects lmfao

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    I posted on LinkedIn about an integration I built with it. I am getting slammmed with work now 😂

  • @sapyoahtml330
    @sapyoahtml3309 ай бұрын

    it says no moduled name openai

  • @HafsaHareem-in4vu
    @HafsaHareem-in4vu11 ай бұрын

    Is there any method to take user input as message?

  • @Reficul999

    @Reficul999

    11 ай бұрын

    U can create a tkinter and use an Entry

  • @crossses

    @crossses

    11 ай бұрын

    Yeah easily so put this content: input("What is your proompt?")

  • @user-lz3cz2zc4w
    @user-lz3cz2zc4w Жыл бұрын

    Ты не пробовал из какой нибудь локальной модели которая полностью доступна в общем доступе, сделать чат?

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Not yet most of the stuff has been with paid APIs unfortunately. Closest was probably the live stream I did with BLOOM.

  • @user-lz3cz2zc4w

    @user-lz3cz2zc4w

    Жыл бұрын

    @@NicholasRenotte Sorry, I'm from Russia and I meant this. Would you like to use a public local model to create a dialog neural network similar to GPTchat. Are you planning this??

  • @czar82ro
    @czar82ro Жыл бұрын

    Nice

  • @josejose-je6xu
    @josejose-je6xu5 ай бұрын

    Cool man

  • @jensontmathew1584
    @jensontmathew15845 ай бұрын

    Can we use this to create chatbot? I am a noob to this field. Please answer anyone... 😊

  • @rohitchanda8461
    @rohitchanda84614 ай бұрын

    Public API?

  • @way2on
    @way2on Жыл бұрын

    chatgpt helped me try random generation of api keys until it works and now i have free chatgpt

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    LOL fr?

  • @way2on

    @way2on

    Жыл бұрын

    @@NicholasRenotte Yea it tries many combinations over and over everytime it returns an error, sometimes it works, sometimes it doesn't. So sorry for whoevers api key was used

  • @FitVerse-oc8vy
    @FitVerse-oc8vy9 ай бұрын

    hello me to developer and ı have an question; what is gpt-4 engine name

  • @FitVerse-oc8vy

    @FitVerse-oc8vy

    9 ай бұрын

    please help me

  • @noahbuscuse5243
    @noahbuscuse5243 Жыл бұрын

    Why would I do this over using the playground

  • @yanivkovler4056
    @yanivkovler40566 ай бұрын

    Why not just use chatgpt promptline?

  • @randomstuffty
    @randomstuffty8 ай бұрын

    where's code

  • @LordDSP3
    @LordDSP37 ай бұрын

    I'm keep getting error that api is invalid or exhausted quota... Is it paid?

  • @tusharrao74

    @tusharrao74

    7 ай бұрын

    It used to be free but it's paid now

  • @LordDSP3

    @LordDSP3

    7 ай бұрын

    @@tusharrao74 that's sad, you know any api / model / lib to make a simple chat bot

  • @alangiovannysanchez5368

    @alangiovannysanchez5368

    5 ай бұрын

    I had the same issue. Bit of a bummer it's no longer free.

  • @nikosnikos-fk6ct
    @nikosnikos-fk6ct9 ай бұрын

    were is the dicreption

  • @kilianlindberg
    @kilianlindberg9 ай бұрын

    only 5-6 month ago.. it was that recently🤔🤓

  • @xBaphometHx
    @xBaphometHx Жыл бұрын

    Is this the pay to use API?

  • @gianmarcoguarnier2525

    @gianmarcoguarnier2525

    Жыл бұрын

    you have three months free

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    Yup!

  • @preetpatel292
    @preetpatel292 Жыл бұрын

    I would rather use ChatGPT to ask it how to use ChatpGPT APIs 🤭

  • @The_Unfamiliar_Circle

    @The_Unfamiliar_Circle

    Жыл бұрын

    Sure buddy, if you want the less advanced text-davinci-002 model

  • @imadbenmadi
    @imadbenmadi10 ай бұрын

    is this Api is free

  • @mahdiabbasinourabadi8554
    @mahdiabbasinourabadi8554 Жыл бұрын

    BOOOM

  • @jessicabrus6549
    @jessicabrus65499 ай бұрын

    I need help

  • @whitedevilcreations5676
    @whitedevilcreations56764 ай бұрын

    How to get API key ?

  • @blackhunter89300

    @blackhunter89300

    2 ай бұрын

    you hvae to pay

  • @hiTocopter
    @hiTocopter9 күн бұрын

    What do you mean recently? The API has been available for years...

  • @antongromek4180
    @antongromek4180 Жыл бұрын

    Nowadays they need computers to say absolutely nothing?🤯

  • @lifewithG-bengs
    @lifewithG-bengs Жыл бұрын

    Is it free or paid?

  • @NicholasRenotte

    @NicholasRenotte

    Жыл бұрын

    This one is paid @Ogunkoya! It seems pretty reasonable though $2 per million words.

  • @chevvvv

    @chevvvv

    Жыл бұрын

    @@NicholasRenotte how do I start this? And where can I get an API key?

  • @ahmedsherif6195
    @ahmedsherif6195 Жыл бұрын

    0:00

  • @OkiDoki181818
    @OkiDoki18181811 ай бұрын

    Is this really chat gpt, or is this gpt? Big difference. The one is a fixed price monthly, the other costs credits. Its misleading if its gpt and not chatgpt

  • @fin1225
    @fin1225 Жыл бұрын

    There will be a leck of programming job's in the future better start with electrical engineering.

  • @Yazan_Majdalawi

    @Yazan_Majdalawi

    11 ай бұрын

    That'll be affected as well, not that much further from programming jobs

  • @sivasaran_s
    @sivasaran_s4 ай бұрын

    Not working

  • @13deshmukhayaancoa93
    @13deshmukhayaancoa934 ай бұрын

    Is this free?

  • @user-uy7kr5zq5s
    @user-uy7kr5zq5s8 ай бұрын

    barack obama?!

  • @nikosnikos-fk6ct
    @nikosnikos-fk6ct9 ай бұрын

    how to make Minecraft in python import Minecraft run yay

  • @JakubSK
    @JakubSK Жыл бұрын

    You don’t

  • @aniakaleta101
    @aniakaleta1017 ай бұрын

    does this guy get on your nerves or is it just me

  • @NicholasRenotte

    @NicholasRenotte

    7 ай бұрын

    nah, gets on my nerves as well

  • @parallellinesmeetatinfinity
    @parallellinesmeetatinfinity Жыл бұрын

    This man have Something wrong in his Neck 😢😢😢😢😅

  • @TLM-Nathan
    @TLM-Nathan9 ай бұрын

    I fail to see how this is anything other than pointless. Why waste time writing all that code when you could just go to chatgpt and ask there? Can we maybe get a practical use for this?

  • @Eddyi1

    @Eddyi1

    8 ай бұрын

    wtf. This can be used to automatize a lot of processes.

  • @isumitd9586
    @isumitd95863 ай бұрын

    Dont know anything about it

  • @Eddie-gb3bn
    @Eddie-gb3bn2 ай бұрын

    What’s the point of this, why not just use the GUI?

  • @seekyboi23
    @seekyboi23 Жыл бұрын

    This is not a ChatGPT

  • @CusPedro
    @CusPedro Жыл бұрын

    This is for the lazy!

Келесі