An open API service indexing awesome lists of open source software.

https://github.com/dragon-fish/github-copilot-ai

Using GitHub Copilot API like OpenAI API.
https://github.com/dragon-fish/github-copilot-ai

copilot-api github-copilot openai openai-api

Last synced: about 2 months ago
JSON representation

Using GitHub Copilot API like OpenAI API.

Awesome Lists containing this project

README

          

# GithubCopilotAI

Using GitHub Copilot API like OpenAI API.

**For learning and research purposes only. There is no guarantee of availability. Don't file issues.**

## Installation

```bash
pnpm add github-copilot-ai
```

## Usage

Just like OpenAI API.

Read more at [OpenAI documentation](https://npmjs.com/package/openai).

```ts
import { GithubCopilotAI } from 'github-copilot-ai'

const client = new GithubCopilotAI({
apiKey: 'YOUR_COPILOT_OAUTH_TOKEN',
})

const response = await client.chat.completions.create({
model: 'claude-sonnet-4',
messages: [
{
role: 'user',
content: 'Who are you?',
},
],
})
```

## How to get Copilot OAuth Token

We create a simple script to get GitHub Auth Token.

```sh
pnpm run oauth
```

Follow the instructions in the script to get your GitHub Auth Token.

Refer to [the source code](./demo/modules/oauth.ts) for more details, if you want to implement it elsewhere or in another language.

## Python version?

https://gist.github.com/dragon-fish/86432fc4baa69875ce1013e0c8dd472c

I'm not good at Python. This entire script is converted from the TypeScript version by copilot itself. ~~WOW, NTR~~

---

> MIT License
>
> Copyright © 2025 @dragon-fish