A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.
Note: Image/vision capabilities are not supported as GitHub Copilot's API does not support image input.
- Bun (version 1.0.0 or higher)
- GitHub account with Copilot Individual subscription
To install dependencies, run:
bun install
You can run the project directly using npx:
npx copilot-api
With options:
npx copilot-api --port 8080 --emulate-streaming
The project can be run from source in several ways:
bun run dev
Starts the server with hot reloading enabled, which automatically restarts the server when code changes are detected. This is ideal for development.
bun run start
Runs the server in production mode with optimizations enabled and hot reloading disabled. Use this for deployment or production environments.
The server accepts several command line options:
Option | Description | Default |
---|---|---|
--help, -h | Show help message | false |
--emulate-streaming | Enable streaming response emulation | false |
--port, -p | Port to listen on | 4141 |
--logs | Write logs to the app directory (requires --emulate-streaming) | false |
Example with options:
bun run start --port 8080 --emulate-streaming
In all cases, the server will start and listen for API requests on the specified port.
The following AI tools have been tested with this API:
- Works with GPT-4o
- Not compatible with Claude 3.5 Sonnet (Cline prompts are too long)
- Fully compatible
- Sometimes models fail to load - you can set any random API key in the UI to refresh the models list
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU General Public License v3.0.