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.
- Host: GitHub
- URL: https://github.com/dragon-fish/github-copilot-ai
- Owner: dragon-fish
- License: mit
- Created: 2025-06-14T15:37:26.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-06-15T16:37:52.000Z (12 months ago)
- Last Synced: 2025-08-21T17:33:23.269Z (10 months ago)
- Topics: copilot-api, github-copilot, openai, openai-api
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 6
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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