Windows-Copilot-API  by sums001

Local OpenAI API for Windows Copilot

Created 3 weeks ago

New!

1,087 stars

Top 34.3% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a reverse-engineered, OpenAI-compatible REST API for Microsoft Copilot, enabling free access to GPT-4 and GPT-5 class models without API keys or billing. It targets developers and power users seeking to integrate Copilot's capabilities into applications using familiar tools, offering a cost-effective, drop-in alternative to official LLM APIs.

How It Works

The project reverse-engineers the copilot.microsoft.com web interface to expose its functionality via a local API. It implements a FastAPI server that mimics the OpenAI API specification (/v1), handling authentication through a one-time browser-based sign-in with a Microsoft account. Session tokens are automatically refreshed. The design supports streaming responses and multi-turn conversations, providing a seamless integration path for existing OpenAI-compatible clients.

Quick Start & Requirements

  • Requirements: Python 3.9+, a Microsoft account. Works on Windows, macOS, and Linux.
  • Setup: Clone the repo, create a virtual environment, install dependencies (pip install -r requirements.txt), install Playwright (playwright install chromium), and sign in (python -m copilot login). Setup takes approximately 2 minutes.
  • Usage:
    • Python library: from copilot import CopilotClient; client = CopilotClient(); client.chat("...")
    • OpenAI-compatible server: python app.py (accessible at http://localhost:8000/v1).
  • Docker: Available via docker compose up --build after host sign-in.
  • Links: Examples provided within the examples/ directory.

Highlighted Details

  • Free Access: Utilizes a personal Microsoft Copilot account, bypassing API fees and key management.
  • OpenAI Compatibility: Offers a local /v1 endpoint compatible with the official OpenAI SDK and other tools.
  • Streaming & Conversations: Supports token-by-token streaming and maintains conversation history via conversation_id.
  • Performance: Benchmarked at 40.9% on GPQA Diamond (closed-book, graduate-level), positioning it within the GPT-4 model family.

Maintenance & Community

This is an unofficial, personal project not affiliated with Microsoft. No specific community channels (e.g., Discord, Slack) or formal roadmap are detailed. Maintenance relies on the original author and community contributions, with potential risks associated with unofficial reverse-engineering efforts.

Licensing & Compatibility

The project is licensed for personal and educational use. Users are responsible for complying with Microsoft's terms of service. Commercial use is implicitly restricted due to its reliance on personal Microsoft accounts and adherence to Microsoft's usage policies.

Limitations & Caveats

As an unofficial project, it may break with future Microsoft Copilot updates. The server serializes requests, limiting concurrent throughput to approximately 1-4 requests. Running on servers or VPS instances may require manual browser verification to bypass bot-detection mechanisms (e.g., Cloudflare). Only a single model, named "copilot" (GPT-4 class), is available. Users must exercise responsible usage and avoid abuse to comply with Microsoft's terms.

Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
31
Star History
1,100 stars in the last 22 days

Explore Similar Projects

Feedback? Help us improve.