DEV Community

Suhaib Bin Younis
Suhaib Bin Younis

Posted on

I Built a VS Code Extension That Turns GitHub Copilot Into a Full OpenAI-Compatible API

The Problem

I was paying for too many AI services.

  • GitHub Copilot: $10/month
  • OpenAI API: $50-100/month
  • ChatGPT Plus: $20/month

One day I realized something obvious: Copilot uses GPT-4. I'm already paying for access to one of the best language models. I just couldn't use it outside of VS Code's autocomplete.

So I fixed that.

What I Built

GitHub Copilot API Gateway — a VS Code extension that exposes your Copilot subscription as a local HTTP server.

GitHub Copilot API Gateway

It implements three API formats:

  • OpenAI (/v1/chat/completions)
  • Anthropic (/v1/messages)
  • Google Gemini (/v1beta/models/:model:generateContent)

Any tool that works with these APIs now works with your Copilot subscription.

Why This Matters

For Individual Developers

You no longer need to:

  • Pay for OpenAI API credits to test LangChain
  • Set up Ollama and download 40GB models
  • Configure local inference with LM Studio
  • Manage API keys across different services

Just point your code at http://127.0.0.1:3030/v1 and it works.

For Teams and Enterprises

The math is simple:

Without This With This
$10 Copilot + $50-200 API costs $10 Copilot
Per developer, per month Per developer, per month

For a team of 50, that's potentially $2,500-10,000/month in savings.

How It Works

Installation

# Install from VS Code Marketplace
ext install suhaibbinyounis.github-copilot-api-vscode
Enter fullscreen mode Exit fullscreen mode

Or search "GitHub Copilot API Gateway" in VS Code.

Start the Server

  1. Open the Copilot API sidebar
  2. Click "Start Server"
  3. Server runs at http://127.0.0.1:3030

Use It

from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:3030/v1",
    api_key="not-needed"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

That's it. Your existing OpenAI code works unchanged.

Framework Integrations

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="http://127.0.0.1:3030/v1",
    api_key="not-needed"
)

response = llm.invoke("Explain recursion")
Enter fullscreen mode Exit fullscreen mode

LlamaIndex

from llama_index.llms.openai import OpenAI

llm = OpenAI(
    api_base="http://127.0.0.1:3030/v1",
    api_key="not-needed"
)
Enter fullscreen mode Exit fullscreen mode

AutoGPT / CrewAI / Any Agent

export OPENAI_API_BASE=http://127.0.0.1:3030/v1
export OPENAI_API_KEY=not-needed

# Now run your agent
python agent.py
Enter fullscreen mode Exit fullscreen mode

Built-in AI Apps

The extension also includes purpose-built AI applications:

Apps Hub

  • Playwright Test Generator — Describe tests in English, get complete projects
  • Code Review Assistant — AI feedback on your diffs
  • Commit Message Generator — Semantic commits from staged changes
  • Documentation Generator — Auto-docs for any codebase

These run directly in VS Code. No external tools needed.

Security Features

This isn't a toy. It includes production-ready security:

  • IP allowlisting
  • Bearer token authentication
  • Rate limiting
  • Request payload limits
  • Automatic data redaction in logs

Configure via VS Code settings:

{
  "githubCopilotApi.server.apiKey": "your-secret",
  "githubCopilotApi.server.ipAllowlist": ["192.168.1.0/24"],
  "githubCopilotApi.server.rateLimitPerMinute": 60
}
Enter fullscreen mode Exit fullscreen mode

API Documentation

Full Swagger UI included at /docs:

Swagger Documentation

Source Code

Everything is open source:

GitHub logo suhaibbinyounis / github-copilot-api-vscode

VS Code extension that exposes the GitHub Copilot API for custom integrations and developer workflows.

GitHub Copilot API Gateway

GitHub Copilot API Gateway

Transform your GitHub Copilot subscription into a complete AI development platform.

VS Code Marketplace GitHub Release License: MIT

Apps HubAPI GatewayGetting StartedConfigurationIntegrations


Why This Extension?

GitHub Copilot API Gateway is more than just an HTTP server—it's a complete AI development platform that maximizes your Copilot subscription:




































What You Get Without This Extension With This Extension
AI Apps None 6 enterprise-grade apps built into VS Code
API Access None Full OpenAI, Anthropic, Google API compatibility
External Tools Limited LangChain, AutoGPT, CrewAI, and 50+ frameworks
MCP Support None Connect any Model Context Protocol server
Cost $10/month (Copilot only) $10/month (everything included)


🎯 Enterprise Apps Hub

Access powerful AI apps directly in VS Code—no external tools needed.

Click 📦 Open Apps Hub in the Copilot API sidebar to launch:

Enterprise Apps Hub

Available Apps














App What It Does
🎭 Playwright Script Generator
Generate complete Playwright test projects from natural language descriptions





Try It

ext install suhaibbinyounis.github-copilot-api-vscode
Enter fullscreen mode Exit fullscreen mode

Or visit the VS Code Marketplace.


If this is useful, consider starring the repo. Questions or feedback? Drop a comment below.

Top comments (0)