Status: [UNTESTED] Endpoints found: http://127.0.0.1:4141/v1/chat/completions http://127.0.0.1:4141/v1/models Source: https://github.com/jerry800416/copilot-local-proxy # Copilot Local Proxy [English](README.md) | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-TW.md) Unofficial local GitHub Copilot proxy. It logs in with GitHub device flow, exchanges that OAuth token for a short-lived Copilot token, and serves OpenAI-compatible `/v1/models`, `/v1/chat/completions`, and `/v1/responses`. Python 3.9+, standard library only. Not an official GitHub, Microsoft, or OpenAI product. Use it only if your Copilot plan and organization policy allow this kind of local integration. ## Architecture ```text Local client -> API key check -> Copilot Local Proxy -> GitHub OAuth token -> short-lived Copilot token -> personal or Business Copilot API ``` The proxy stores its own OAuth credentials, refreshes them before expiry, and uses the endpoint returned by Copilot token exchange. That may be a personal or Business Copilot API host. ## Features - GitHub OAuth device-flow login - OAuth token stored locally and refreshed before expiry - OAuth token exchanged for a short-lived Copilot token - Personal and Business Copilot endpoints - Token cache, refresh before expiry, and one retry on 401/403 - `/v1/models`, `/v1/chat/completions`, `/v1/responses` - Chat Completions and Responses conversion, including SSE and tool calls - Nested Chat Completions tools (`{"type":"function","function":{"name":...}}`); Claude stays on `/chat/completions` - `reasoning` and `reasoning_effort` forwarded upstream - Local account page at `/` with English / 简体中文 / 繁體中文 - Multiple GitHub accounts and API keys - Standard library only ## Setup 1. Create a GitHub OAuth App under **Settings → Developer settings → OAuth Apps**. Enable Device Flow. You need the Client ID only, not the Client Secret. 2. Set the two required variables: ```bash export COPILOT_OAUTH_CLIENT_ID='your-oauth-client-id' export COPILOT_PROXY_API_KEY="$(python3 -c 'import secrets; print(secrets.token_urlsafe(48))')" ``` 3. Start the proxy on `127.0.0.1:4141`.