Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

dragon-fish/github-copilot-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

14 Commits

Repository files navigation

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

pnpm add github-copilot-ai

Usage

Just like OpenAI API.

Read more at OpenAI documentation.

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.

pnpm run oauth

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

Refer to the source code 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

About

Using GitHub Copilot API like OpenAI API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /