B00TK1D / copilot-api

GitHub Copilot API
MIT License
123 stars 21 forks source link

Copilot.api

Provides a simple HTTP API to interface with GitHub Copilot, including native GitHub authentication.

Installing dependencies

pip install -r requirements.txt

Run

python3 api.py [port]

Usage

Send a POST request to http://localhost:8080/api with the following JSON body:

Request payload

{
    "prompt": "# hello world function\n\n",
    "language": "python"
}

Response

The response will be a plain text string containing the generated code.

def hello_world():

In order to build a complete code snippet, iteratively append the generated code to the prompt and send it back to the API until the response is empty.