Skip to content

Commit b9c0cbc

Browse files
chore: cleanup readme and package.json for v2.1.0 release
1 parent e05606a commit b9c0cbc

52 files changed

Lines changed: 6821 additions & 30377 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,247 @@
2424
</a>
2525
</p>
2626

27+
<p align="center">
28+
<a href="#-universal-api-gateway">Universal API Gateway</a> •
29+
<a href="#-security--controls">Security & Controls</a> •
30+
<a href="#-api-endpoints">API Endpoints</a> •
31+
<a href="#-ecosystem--integrations">Ecosystem & Integrations</a> •
32+
<a href="#-getting-started">Getting Started</a>
33+
</p>
34+
35+
---
36+
37+
## 🌐 Universal API Gateway
38+
39+
**GitHub Copilot API Gateway** acts as a bridge between your local development environment and GitHub Copilot. It starts a local HTTP server that standardizes communication, allowing you to use Copilot with **any AI SDK or tool**.
40+
41+
### One Subscription, Any Model
42+
43+
Why pay for separate API keys? Use your existing Copilot subscription to power tools that expect:
44+
- **OpenAI** (GPT Family: `gpt-4o`, `gpt-3.5-turbo`)
45+
- **Anthropic** (Claude Family: `claude-3-5-sonnet`)
46+
- **Google** (Gemini Family: `gemini-1.5-pro`)
47+
- **Meta** (Llama Family)
48+
49+
### Seamless Compatibility
50+
51+
Simply point your client to `http://127.0.0.1:3030` and it works like magic.
52+
53+
```python
54+
# Create an OpenAI client that talks to Copilot
55+
from openai import OpenAI
56+
57+
client = OpenAI(
58+
base_url="http://127.0.0.1:3030/v1",
59+
api_key="copilot" # API key is ignored, your authenticated session is used
60+
)
61+
62+
response = client.chat.completions.create(
63+
model="gpt-4o",
64+
messages=[{"role": "user", "content": "Hello!"}]
65+
)
66+
```
67+
68+
### 🔓 What This Unlocks
69+
By standardizing Copilot as a local API, you instantly gain access to the entire AI ecosystem:
70+
71+
| Category | Tools & Frameworks | Use Cases |
72+
| :--- | :--- | :--- |
73+
| **Orchestration** | **LangChain**, **LlamaIndex**, **Flowise** | Build RAG pipelines, chat with your PDF/Notion data. |
74+
| **Agents** | **AutoGPT**, **CrewAI**, **BabyAGI** | Run autonomous researchers and task-solvers locally. |
75+
| **Dev Tools** | **Cursor**, **Aider**, **Open Interpreter** | Pair program in your terminal or specialized IDEs. |
76+
| **No-Code** | **Bubble**, **Zapier** (via local tunnel) | Connect enterprise workflows to Copilot intelligence. |
77+
78+
*"Turn your VS Code into the engine room for your AI experiments."*
79+
80+
---
81+
82+
## 👥 Who Is This For?
83+
84+
Whether you're building the next unicorn or just learning to code, this extension levels the playing field.
85+
86+
### 🎓 Students & Researchers
87+
**Don't let API costs block your learning.**
88+
If you have the **GitHub Student Developer Pack**, you likely have free access to Copilot. Use this gateway to build RAG apps, agents, and complex systems that usually require expensive API credits. Experiment purely without fear of a surprise bill.
89+
90+
### 💼 Professionals & Indie Hackers
91+
**Prototype at the speed of thought, for free.**
92+
Stop burning your personal credit card on API calls during development. Use your $10/mo Copilot subscription to power your entire dev, test, and staging environments. Build full-stack AI features locally before deploying to production.
93+
94+
### 🏢 Enterprises & Teams
95+
**Secure, Compliant AI for every developer.**
96+
Leverage your existing GitHub Copilot Business/Enterprise licenses.
97+
- **Data Privacy:** Keep traffic local or within your VPN.
98+
- **No Shadow IT:** Developers don't need personal API keys to use advanced tools like Cursor or Aider.
99+
- **Unified Billing:** One subscription covers IDE completion *and* API-based workflows.
100+
101+
---
102+
103+
## 🔒 Security & Controls
104+
105+
We understand that exposing an API requires strict control, especially in enterprise environments. This extension is built with **security-first principles**.
106+
107+
### 🛡️ Access Control
108+
- **IP Allowlisting:** Restrict access to specific IP addresses (e.g., VPNs, local subnets).
109+
- **Bearer Authentication:** Enforce a custom API Key (`server.apiKey`) for all incoming requests.
110+
- **Connection Limits:** Set maximum concurrent connections per IP to prevent abuse.
111+
112+
### 📝 Audit & Observability
113+
- **Full Audit Logging:** Every request and response is logged with timestamps, status codes, and latency.
114+
- **Data Redaction:** Sensitive information (API keys, PII) is automatically redacted from logs using configurable regex patterns.
115+
- **Live Dashboard:** Monitor real-time traffic, token usage, and error rates directly within VS Code.
116+
117+
### ⚡ Performance Guardrails
118+
- **Rate Limiting:** Configurable requests-per-minute limits.
119+
- **Payload Limits:** Rigorous checks on request sizes to ensure stability.
120+
- **Optimized Core:** Built on a zero-dependency, high-performance Node.js HTTP server.
121+
122+
---
123+
124+
## 📚 API Endpoints
125+
126+
The gateway provides fully compatible endpoints for major AI providers.
127+
128+
| Provider | Endpoint | Method | Description |
129+
|----------|----------|--------|-------------|
130+
| **OpenAI** | `/v1/chat/completions` | `POST` | Full support for streaming, tools, and JSON mode. |
131+
| **OpenAI** | `/v1/models` | `GET` | List available models from your Copilot plan. |
132+
| **Anthropic** | `/v1/messages` | `POST` | Compatible with Anthropic SDKs (Claude). |
133+
| **Google** | `/v1beta/models/:model:generateContent` | `POST` | Compatible with Google Generative AI SDKs. |
134+
| **Llama** | `/llama/v1/chat/completions` | `POST` | Targeted support for Llama client libraries. |
135+
| **Utilities** | `/v1/tokenize` | `POST` | Count tokens for a given string (OpenAI format). |
136+
| **Utilities** | `/metrics` | `GET` | Prometheus-compatible metrics endpoint. |
137+
| **Utilities** | `/health` | `GET` | Service health check & Copilot status. |
138+
| **Utilities** | `/docs` | `GET` | **Offline Swagger UI** for interactive testing. |
139+
140+
### Interactive Documentation (Swagger UI)
141+
142+
Explore the API offline at `http://127.0.0.1:3030/docs`.
143+
- **Try it out:** Send real requests from your browser.
144+
- **Schema Explorer:** View detailed request/response definitions.
145+
- **Secure:** Served locally, no external assets loaded.
146+
147+
---
148+
149+
## 🔌 Ecosystem & Integrations
150+
151+
Build the future of AI with your favorite tools. The gateway is designed to be a drop-in replacement for any system expecting an OpenAI-compatible endpoint.
152+
153+
### 🤖 AI Frameworks
154+
Connect seamlessly with industry-standard orchestration libraries:
155+
- **[LangChain](https://langchain.com):** Build RAG pipelines and agents. Simply set `OPENAI_API_BASE=http://127.0.0.1:3030/v1`.
156+
- **[LlamaIndex](https://llamaindex.ai):** Index your private data and query it using Copilot's models.
157+
- **[Semantic Kernel](https://github.com/microsoft/semantic-kernel):** Integrate directly with Microsoft's enterprise-grade SDK.
158+
159+
### 🛠️ Developer Tools
160+
Supercharge your CLI and editor workflows:
161+
- **[Cursor](https://cursor.sh):** Use Copilot as your backend model provider.
162+
- **[Aider](https://aider.chat):** The AI pair programmer in your terminal.
163+
- **[Open Interpreter](https://openinterpreter.com):** Let language models run code on your computer.
164+
165+
### 🧠 Autonomous Agents
166+
Power resource-intensive agent loops without breaking the bank:
167+
- **[AutoGPT](https://github.com/Significant-Gravitas/AutoGPT):** Run continuous autonomous tasks.
168+
- **[CrewAI](https://crewai.com):** Orchestrate teams of AI agents.
169+
170+
*"If it speaks OpenAI, it works with Copilot API Gateway."*
171+
172+
---
173+
174+
## 🚀 Getting Started
175+
176+
### 1. Installation
177+
Install **GitHub Copilot API Gateway** from the VS Code Marketplace.
178+
*Requirements: VS Code 1.95+ and GitHub Copilot Chat extension.*
179+
180+
### 2. Start the Server
181+
Click the **"Start Server"** button in the extension sidebar, or run the command `GitHub Copilot: Start API Server`.
182+
183+
### 3. Usage & Network Configuration
184+
By default, the server is secure and only accessible from your local machine (`127.0.0.1`).
185+
186+
**To share Copilot with your LAN (e.g., test on mobile, share with a colleague):**
187+
1. Open VS Code Settings.
188+
2. Search for `githubCopilotApi.server.host`.
189+
3. Change value from `127.0.0.1` to `0.0.0.0` (Listen on all interfaces).
190+
4. Your API is now accessible at `http://<YOUR-LAN-IP>:3030`.
191+
192+
> 💡 **Tip:** Use the **IP Allowlist** feature to ensure only trusted devices on your network can connect.
193+
194+
### Configuration
195+
Customize your experience in VS Code Settings (`githubCopilotApi.*`):
196+
197+
```json
198+
{
199+
"githubCopilotApi.server.port": 3030,
200+
"githubCopilotApi.server.host": "127.0.0.1",
201+
"githubCopilotApi.server.apiKey": "my-secret-token",
202+
"githubCopilotApi.server.ipAllowlist": ["127.0.0.1", "192.168.1.0/24"]
203+
}
204+
```
205+
206+
---
207+
208+
## ❓ Frequently Asked Questions (FAQ)
209+
210+
**Q: Can I use this to get free GPT-4 access?**
211+
A: This extension uses your *existing* GitHub Copilot subscription. If your plan includes GPT-4 (like most do), then yes, you can access GPT-4 programmatically without paying extra OpenAI API fees.
212+
213+
**Q: Does this work with local LLMs like Ollama or LM Studio?**
214+
A: This extension *is* a local LLM server, but powered by GitHub's cloud. It is a perfect alternative to running heavy local models if your hardware is limited, offering cloud-quality performance (GPT-4o, Claude 3.5) with local-like control.
215+
216+
**Q: Is this safe for enterprise use?**
217+
A: Yes. It runs entirely locally on your machine. No data is sent to any third-party server other than GitHub itself. You can enforce strict **IP Allowlisting** and **Audit Logging** to meet compliance requirements.
218+
219+
---
220+
221+
## 🏆 Why Developers Choose This Gateway
222+
223+
| Feature | **Copilot API Gateway** | Local LLMs (Ollama) | Direct Cloud APIs |
224+
| :--- | :---: | :---: | :---: |
225+
| **Model Quality** | 🌟 **S-Tier (GPT-4o/Claude)** | B-Tier (Llama/Mistral) | S-Tier |
226+
| **Hardware Reqs** | 💻 **Minimal (Any CPU)** | 🔋 High (GPU Required) | None |
227+
| **Cost** | 💸 **Fixed ($10/mo)** | Free | 💸 Pay-per-token ($$$) |
228+
| **Setup** |**1 Click (VS Code)** | Complex | Easy |
229+
| **Privacy** | 🔒 **Local Proxy** | Local | Cloud |
230+
231+
---
232+
233+
## 💰 Cost Comparison
234+
235+
| Feature | **This Extension** | OpenAI API | Anthropic API |
236+
|:--------|:------------------:|:----------:|:-------------:|
237+
| **Cost** | **$0 (Included in Copilot)** | Pay-per-token | Pay-per-token |
238+
| **Models** | GPT-4o, Claude 3.5, Gemini | GPT models only | Claude models only |
239+
| **Privacy** | Local Proxy | Cloud API | Cloud API |
240+
241+
---
242+
243+
## 📝 License & Disclaimer
244+
245+
**MIT License.**
246+
247+
> **Disclaimer:** This extension is an independent project and is not affiliated with GitHub, Microsoft, or OpenAI. It leverages your existing GitHub Copilot subscription enabling you to use it in new ways. Use responsibly.
248+
249+
<p align="center">
250+
<strong>Built with ❤️ by <a href="https://suhaibbinyounis.com">Suhaib Bin Younis</a></strong>
251+
</p>
252+
253+
<p align="center">
254+
<a href="https://marketplace.visualstudio.com/items?itemName=suhaibbinyounis.github-copilot-api-vscode">
255+
<img src="https://img.shields.io/visual-studio-marketplace/v/suhaibbinyounis.github-copilot-api-vscode?style=for-the-badge&logo=visual-studio-code&logoColor=white&label=VS%20Code%20Marketplace" alt="VS Code Marketplace">
256+
</a>
257+
<a href="https://github.com/suhaibbinyounis/github-copilot-api-vscode/releases">
258+
<img src="https://img.shields.io/github/v/release/suhaibbinyounis/github-copilot-api-vscode?style=for-the-badge&logo=github" alt="GitHub Release">
259+
</a>
260+
<a href="https://open-vsx.org/extension/suhaibbinyounis/github-copilot-api-vscode">
261+
<img src="https://img.shields.io/open-vsx/v/suhaibbinyounis/github-copilot-api-vscode?style=for-the-badge&logo=eclipse-ide&logoColor=white&label=Open%20VSX" alt="Open VSX Registry">
262+
</a>
263+
<a href="https://opensource.org/licenses/MIT">
264+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" alt="License: MIT">
265+
</a>
266+
</p>
267+
27268
<p align="center">
28269
<a href="#-universal-api-gateway">Universal API Gateway</a> •
29270
<a href="#-security--controls">Security & Controls</a> •

0 commit comments

Comments
 (0)