Full Transcript
Hey folks, in this video we are going to be looking at bringing your own key to Visual Studio Code and GitHub Copilot. We'll explore how, what, and why you would want to do this, and I'll also show you how you can do that with a third-party provider. Let's start with what it is. Well, bring your own key basically means you can bring a new model or a key to another model elsewhere. So, the moment you're currently stuck with these models on GitHub Copilot, and that's just through proprietary systems that we have set in place before, and that is what is on offer for you. Now, with the extendability of bringing your own key, if you have a model hosted elsewhere or a different provider, you can now import that into Visual Studio Code and use it with GitHub Copilot. There are a number of reasons why you might want to do this. For instance, maybe compliance inside your organization, maybe costing, or maybe even performance. So, there's a whole number of reasons why you could do this. Now, let me show you how to do it. Okay, so the first thing we need is a key, and I'm using OpenRouter for this. So, I've made myself an API key. Not going to click on that one. And then I'm going to search for a model. I'm just searching for DeepSeek v4- it's free, right? It's a free free option here inside OpenRouter. You can see you've got the price, you've got the total contacts, you've got the max output tokens. All the information you need is right here. So, what I can do now is I can go over to Visual Studio Code. Now, I've got my API key. I'm going to open up a Copilot chat window, and just where you go to select model, there's a little cog. Now, if you click on that, it will open up the language model selector. As you can see, I've got some models from Copilot, Ollama, but if I click on add models and then add a custom endpoint, I can just enter the name, which is OpenRouter. I mean, I can I can call that whatever. And then I'm going to add in my API key which I'm using. For this, I'm going to use the Uh, maybe the chat completions uh, for this one. And then it will open up the chat language models.json file. Now, this is in your user settings. This then just allows you to go and edit and add in all the information that we need for this model. So, right at the very top, I'm just going to copy over the name and the ID for that model. So, the deep seek model here, I'm just going to pop it into ID and name. And then I'm going to use the URL for open router, which I'm I'm just copying across here. I'm just going to paste this in, but it's openrouter.ai/api/v1. I'm going to allow tool calling. I'm going to say vision, yes. But, this is where I need to get the total context and the the tokens um, for max output. So, what's that? 1.05 million um, input tokens here. So, let me just type that out. And then exactly the same for the max output tokens. So, that's like 38,000 or 384,000. There you go. And now what I can do is I can save that file and head over to other models. You can now see that open router category now with deep seek. And I've now I can now go ahead and select that from my drop down. And then I can just type in, "Hi deep seek." And that model should be then routing off to open router. And there we go. We get our third-party model just like that. Now, that was just one way of adding in a third-party provider for external models. But, there is also other ways you can use this. You may have just seen that I had Ollama inside there as well. So, that's connecting to Ollama running on my local machine. But, you can also use extensions to get access to these third-party and external models. So, I'm going to be showing you how you can now look at the Foundry toolkit extension to enable you to have access to all of these extra models through Microsoft Foundry. So, I'm just going to head over to the extension marketplace inside VS Code. And I'm going to search for Foundry toolkit. This is going to allow me to connect to a Foundry instance in Microsoft Azure. So, I'm going to install the release version. I'm going to do pre-release. Release is plenty fine for what we're doing today. Then, I'm just going to have a little poke around. So, you can see like kind of all the details it gives you. And then, I'm actually going to open up the extension itself. So, I'm just going to find it in my tool pane. And you can see down here that you've got the ability to discover new models. You can discover tools. You can build. You can create agents. You do all sorts of things from this extension. Now, if I was to have a little look at the model catalog, you can see really what's available to you. You have a whole bunch of models. Very similar to what I was just showing you in Open Router. However, here you can actually filter by Foundry Local. Foundry Local is again just like a local version of Foundry. So, you can host these models locally. Like you've got Deep Sea Cod 1, Quen, fine models, all these kind of things. All right, the smaller models that you can run on your machine. But when you install the extension, by default you would then actually get access to a whole bunch of these models locally. And yes, of course, you need to make sure they're installed or downloaded or deployed wherever they are. But this is a really easy way to get direct access to extra models from within Visual Studio Code and GitHub Copilot. And there we have it, folks. That is how you can bring your own key to get up Copilot and Visual Studio Code for your extended development practices. Now, drop a comment, give us a like, and see you in the next one. Happy coding.