Beyond GTP: Use HuggingFace Models with GitHub Copilot

TLDR

GitHub Copilot is an incredible tool, but I recently discovered I was only scratching the surface of its potential. By sticking to its default models, I was leaving a world of specialized, powerful, and open-source alternatives on the table. This post is about my “aha!” moment—realizing I could integrate any model from HuggingFace—and includes a full video tutorial showing you exactly how to do it, too.


As developers, we’re always looking for tools that give us leverage. For the past year, GitHub Copilot has been that tool for me. But as I’ve taken on more complex tasks, I’ve occasionally hit its limits. Sometimes the suggestions weren’t quite right for a niche framework, or the refactoring advice felt too generic. This led me to a simple but powerful realization: there’s a huge difference between using a tool’s defaults and customizing it for the job at hand.

The Lightbulb Moment

The default Copilot experience is fantastic for general-purpose coding, but what happens when you need something more specialized? It clicked for me when I learned about the Hugging Face Provider for VS Code. Suddenly, a new world of possibilities opened up.

  • The Default Path: Relying on the standard, out-of-the-box model. It’s convenient and effective for most common tasks, but its limitations can be an unwelcome surprise when you’re on a tight deadline.
  • The Custom Path: Taking a few minutes to connect a specialized model from Hugging Face. It requires a little setup (the “bad news,” if you can call it that), but it equips you with the right tool for the job, turning potential surprises into planned advantages.

My Daily Reality

On my current project, I found myself needing to refactor a Python service from the classic requests library with multithreading to a modern, asynchronous implementation using HTTPX. This is exactly the kind of nuanced task where a specialized coding model can shine. Instead of fighting with generic suggestions, I wanted an assistant that truly understood the asynchronous paradigm.

This was the perfect opportunity to put my newfound knowledge to the test.

The Solution: A Practical Tutorial

I documented my entire journey, from setup to a successful refactor, in a video tutorial. It covers everything you need to know to connect Hugging Face to your Copilot Chat in VS Code.

In the video, you’ll learn how to:

  1. Install the HuggingFace Provider extension from here.
  2. Configure your API key to get access from here.
  3. Browse and select from thousands of models.
  4. Use a new model to tackle a real-world coding challenge.

Here’s the Tutorial Video

Why This Matters

This isn’t just about adding more models; it’s about changing how you approach problem-solving.

  • For Developers: It means less frustration and more creative control. Stuck on a tricky regex problem or working with a niche language like Rust or Julia? There’s probably a model fine-tuned for that.
  • For Teams: It allows you to experiment with and even standardize on specific open-source models that fit your company’s stack and policies, ensuring consistency and leveraging the best the open-source community has to offer.

Call to Action: Start Small

You don’t have to switch your entire workflow overnight.

  • Tomorrow: In your VS Code, browse the list of available Hugging Face models. Just see what’s out there.
  • This Week: Follow the first half of the tutorial and connect your Hugging Face account. Pick one model like CodeLlama and ask it one question.
  • Your Next Task: Before you start a complex refactor or a new feature, ask yourself: “Is there a specialized model that could make this easier?”