npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-sdk-provider-github-copilot

v0.0.1

Published

Vercel AI SDK provider for GitHub Copilot - Use your Copilot subscription with the AI SDK

Readme

AI SDK Provider for GitHub Copilot

npm version License: MIT

Use your GitHub Copilot subscription with the Vercel AI SDK.

This provider allows you to access models available through GitHub Copilot (GPT-4o, Claude, Gemini, etc.) using the standard AI SDK interface.

Installation

npm install ai-sdk-provider-github-copilot ai

Authentication

Before using the provider, you need to authenticate with GitHub Copilot using the OAuth device flow:

import { login } from "ai-sdk-provider-github-copilot";

// This will print a URL and code to enter in your browser
await login();

The authentication flow:

  1. Opens a device code flow with GitHub
  2. You visit the URL and enter the code
  3. Authorize the application
  4. Tokens are stored in ~/.ai-sdk-copilot/auth.json

Token Refresh

The provider automatically handles token refresh. GitHub Copilot tokens expire frequently (~30 minutes), but the provider will transparently refresh them using your stored GitHub OAuth token.

Usage

Basic Usage

import { copilot } from "ai-sdk-provider-github-copilot";
import { generateText } from "ai";

const result = await generateText({
  model: copilot("gpt-4o"),
  prompt: "Explain quantum computing in simple terms",
});

console.log(result.text);

Streaming

import { copilot } from "ai-sdk-provider-github-copilot";
import { streamText } from "ai";

const result = await streamText({
  model: copilot("claude-sonnet-4"),
  prompt: "Write a poem about coding",
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Custom Provider Instance

import { createCopilot } from "ai-sdk-provider-github-copilot";

const copilot = createCopilot({
  // Optional: GitHub Enterprise URL
  enterpriseUrl: "https://github.mycompany.com",
  // Optional: Custom headers
  headers: {
    "X-Custom-Header": "value",
  },
});

const result = await generateText({
  model: copilot("gpt-4o"),
  prompt: "Hello!",
});

Available Models

GitHub Copilot provides access to various models. The available models may change based on your subscription:

| Model ID | Description | | ------------------- | --------------------------- | | gpt-4o | OpenAI GPT-4o | | gpt-4o-mini | OpenAI GPT-4o Mini | | gpt-4.1 | OpenAI GPT-4.1 | | gpt-4.1-mini | OpenAI GPT-4.1 Mini | | gpt-4.1-nano | OpenAI GPT-4.1 Nano | | claude-sonnet-4 | Anthropic Claude Sonnet 4 | | claude-3.5-sonnet | Anthropic Claude 3.5 Sonnet | | gemini-2.0-flash | Google Gemini 2.0 Flash | | gemini-2.5-pro | Google Gemini 2.5 Pro | | o1 | OpenAI o1 | | o1-mini | OpenAI o1 Mini | | o3-mini | OpenAI o3 Mini |

You can also use any model ID string that GitHub Copilot supports.

API Reference

login(enterpriseUrl?: string): Promise<void>

Initiates the GitHub OAuth device flow for authentication.

logout(): void

Clears stored authentication tokens.

isAuthenticated(): boolean

Returns whether the user has stored authentication tokens.

createCopilot(settings?: CopilotProviderSettings): CopilotProvider

Creates a new Copilot provider instance with custom settings.

copilot

Default provider instance (requires prior authentication via login()).

Disclaimer

This is an unofficial community provider and is not affiliated with or endorsed by GitHub or Microsoft. By using this provider:

  • You understand that your data will be sent to GitHub Copilot's servers
  • You agree to comply with GitHub's Terms of Service
  • You acknowledge this software is provided "as is" without warranties of any kind

License

MIT