with the constant Innovation AI right now I'm always looking for new ways to try out the latest models especially API so I can just plug them into my existing applications and see how they work but if I'm just playing around I don't want to bring up the credit card again to buy yet more API credits I found a way to access some of the top models apis including GPT 40 for free in this video I'll show you how to get the API key and get it working if you go to GitHub Marketplace it actually has
a section for models here I'll leave a link to this in the description of the video so just get logged into your GitHub account and I can just be a free free account you don't need to put your credit card or anything you can access all these models for free they do have the new 01 models as well but for those ones you actually have to get on a wedding list to to access them so your mileage may vary on those ones but they do have GPD 40 GPD 40 mini also have the latest llama
Lama 3.2 and mistro as well so let's try out GPT 40 so the first thing you want to do is get an API key so you just click the link here and then say get developer key and then here you can say create new token and I recommend just use the class here it's actually easier to create the new token and then just give it a name and expiration if you want to but then where it says select Scopes here actually don't select anything here just leave it totally blank and say generate token because this
token is really to identify what GitHub account you're using it's not really giving it permissions to anything and then from there it just gives you the tokens you can just copy it okay so now we have the API key we just have to add it to our application now and the easiest way to figure out how this all works is if you just go to the playground here under the model you're using it just opens up a chat inter yourface but then you can just click on code here and now it's gives us the actual
code it's using to connect to the API and the nice thing about this is you'll notice it actually just uses the open AI packages so basically works exactly the same as if you went to open AI directly and use a developer console except this way it doesn't cost you anything some of the differences is actually the base URL is different so that's actually hosted on Azure from Microsoft so the base URL points to that and then they call the the token that's one we just got they call the GitHub token but you can really name
this whatever you want in your environment variable so this how you use in JavaScript you get also select other languages they have python C Etc so now I'm going to take an application I built in one of my last videos it uses Gro and Lama 3.2 for its API I going swap it up with this so if we look at that existing application where I'm using Gro the way I connect to it is using this create open AI here which is actually part of this AI SDK from verell and if you actually wanted to use
a lam in your application I would stick with this method here and now I switched it over and for my token I just pasted in that token we got earlier better practice is to use an environment variable and then we just change the endpoint to be that new one for Azure and then just set the model number GPT 40 and that's really all the changes I had to make here cuz everything else works exactly the same as before cuz using the same open AI packages which makes it nice cuz you really just swap it out
like for example if you built something just using the open AI packages directly you could really just change your token into this GitHub one and you can start using it for free okay let's run that and see how it works I we ask about a solar panel now it's going to go out out to GPT 40 and come back with the answer for us and everything else about my application remain the same it still has the custom instructions about how it responds this cuz this supposed to be more like a customer support and sales chat
box all that stuff still worked basically just swall with the model for this free one from GitHub so make sure you check out the models on GitHub Marketplace it's really good resource they do have fairly little limits for example that GPT 401 I use this there it has 50 requests a day limit but still not bad for prototyping and you can't beat the price but if you want to use the latest Lama model I still stick with Gro cuz it's much faster and has much higher limits like very high limits in terms of how much
you can use for free I did a couple videos on that recently so I'll link to those at the end I hope you enjoy this quick video and make sure you subscribe cuz I have lots more AI content coming up I hope you're having an amazing day and I'll talk to you in the next one