Skip to content

Reverse engineered GitHub Copilot API, for use with OpenAI API Compatible services.

License

Notifications You must be signed in to change notification settings

RobbyV2/GH-Copilot-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GH-Copilot-API

GH-Copilot-API is a reverse engineered GitHub Copilot API, for use with OpenAI API Compatible services.

Please make sure to follow GitHub copilot TOS, and try to stick to coding-related tasks, as there is a non-zero chance of being permanently restricted from using Copilot.

Setup

  1. Get the "refresh token"

    The refresh token is pretty much your account token, but in this case it's restricted to Copilot use.

    • Run the following command and note down the returned device_code and user_code.:
    # 01ab8ac9400c4e429b23 is the client_id for VS Code
    curl https://github.com/login/device/code -X POST -d 'client_id=01ab8ac9400c4e429b23&scope=user:email'
    curl https://github.com/login/oauth/access_token -X POST -d 'client_id=01ab8ac9400c4e429b23&scope=user:email&device_code=YOUR_DEVICE_CODE&grant_type=urn:ietf:params:oauth:grant-type:device_code'
    • Note down the access_token starting with gho_.
  2. Install and configure

    git clone https://github.com/RobbyV2/GH-Copilot-API.git
    cd GH-Copilot-API
    poetry install
    cp config.json.example config.json
    # Edit config.json with your refresh token, host, port, and auth tokens.
  3. Run

    poetry run python -m gh_copilot_api.main

    The server will start using the host and port specified in your config.json.

Use

Any standard OpenAI API compatible service should now work with the exposed API. This works for services like Open WebUI, and Cline.

Notes

  • Despite some of the GitHub Copilot models having vision capabilities, GitHub does not provide any direct way to interface with these capabilities.

About

Reverse engineered GitHub Copilot API, for use with OpenAI API Compatible services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages