Install the AI SDK and Select a Provider — Transcript

Transcript of the free Vue.js lesson Install the AI SDK and Select a Providerwatch the video lesson.

Let's get the AI SDK and our choice provider installed. On the AI SDK homepage, we can copy the npm install command. And then over in our project, let's run it. This will install the core AI package.

However, that's not all we need to interact with a model. We also need to install a provider specific package that's found on the providers page. On the AI SDK docs, there are lots of them available. The one we're going to use in our course is the Google generative AI package.

There are several reasons for this. Number one, it's honestly just my favorite at this point, mostly because of its robust image generation capabilities. I mean, come on, you've heard of nano banana, right? But it's also got a generous free tier, as well as an affordable cost per token.

Once you exceed free tier limits to install it, let's choose the npm installation method here and copy that command. Notice the pattern, all of our different providers are namespaced under AI SDK, and then given the specific provider name. Meaning you could change this out to open AI, anthropic, and so on if you would like. In fact, if you want to follow along with a different provider, because you simply like them better, or because you already have tokens purchased with that provider, then feel free to go back to the providers page and install the one that you prefer.

Most everything will be exactly the same, which is exactly the point. Okay, back over in our project, let me run that install. And then inside of package dot JSON, let's take a note of the two new dependencies. Here we have AI as well as AI SDK, Google.

However, I noticed that we're working with AI version five. That's not what I wanted. Instead, we want to work with the latest and greatest that is version six, or the beta version. So let me open up the terminal one more time.

And this time when I run npm I AI, let's add the beta version, then I will do the same thing for AI SDK slash Google. That's better. Now we're version six. com slash app slash API keys, which I've linked to in the description below and create a key for the project.

Inside a dot ENV file, define the variable Google generative AI API key, and then set it to your key from the dashboard. If you wanted to use a different provider, the AI SDK docs will tell you exactly the name of the EMV variable that you should use. In the next lesson, let's generate some text with Gemini.