Skip the API: Building a Local ChatGPT Bridge for VS Code

Can you skip the API and wire ChatGPT directly into VS Code? Turns out, yes — with a little browser magic. This post breaks down how I thought about building a local-first bridge that replaces Kilo and avoids token costs, all powered by curiosity and a builder’s mindset.

Skip the API: Building a Local ChatGPT Bridge for VS Code

What if you could connect ChatGPT directly to your editor — no API key, no per-token billing — and still get structured code completions?

This started as a late-night thought experiment. But like most things in my workflow, it quickly turned into a buildable idea.


The Premise

I was already using ChatGPT Plus. I was also using tools like Kilo, Claude, and other AI dev agents to refactor code, automate diffs, and ship faster.

But I started wondering:

Why am I paying per-token for OpenAI’s API when I’m already paying for unlimited GPT-4o inside the ChatGPT UI?

More importantly:

Can I just build a VS Code plugin that pipes code in and out of a ChatGPT browser session?

Short answer: Yes. You can.
Long answer: It’s not elegant — but it works.


Prompt Evolution (Real Chat History)

I started with:

“How feasible would it be to write a Viscose plugin that connects to you via API so I can replace Kilo?”

ChatGPT: Totally feasible. Use the OpenAI API, pass in file context, return completions or diffs, inject into editor. Rebuild Kilo’s core logic yourself.

Then I refined:

“Prompt yourself to ask my question better. In my tone.”

ChatGPT rewrote it:

“How hard would it be to drop Kilo and just run you through a custom VS Code plugin instead? Full replacement. Can I wire you up and ditch the rest?”

Finally, the real unlock:

“To avoid API token costs, can I build a plugin that uses a browser for I/O, since I already pay for ChatGPT Plus?”

And ChatGPT confirmed:

Yes. You can build a VS Code plugin that:Sends code to ChatGPT via clipboard or embedded WebViewReceives output and injects it back into the editorBypasses the API completely

What This Actually Looks Like

There are a few implementation paths:

Option 1: Clipboard Sync (Manual Bridge)

  • Select code in VS Code
  • Hotkey to copy → auto-paste into ChatGPT tab
  • Copy reply → paste back into file
  • Wrap with custom commands/macros for speed

Option 2: WebView + DOM Sync (Semi-Automated)

  • Create a VS Code extension with a ChatGPT WebView panel
  • Hook into the DOM of the embedded session
  • Programmatically send and receive text
  • No need for API — just browser automation

Option 3: Puppeteer Bridge (Full Automation)

  • Launch Chrome with Puppeteer
  • Log in to ChatGPT
  • Inject prompts, wait for DOM response
  • Pipe result into VS Code

This one’s the most brittle (ChatGPT DOM changes often), but it’s surprisingly robust for light workflows.


Tradeoffs

FeatureBrowser BridgeOpenAI API
Cost✅ Included w/ Plus💸 Pay per token
Control✅ Full prompt design✅ Full prompt design
Stability⚠️ Subject to UI changes✅ Stable API contract
Performance🟡 Slower✅ Fast
Memory / Threads🟡 Manual management🟡 Manual management

Why This Matters

I’m not doing this to be clever. I’m doing it because it’s the kind of move that compounds over time.

Owning your interface with the AI layer gives you:

  • Control over prompt engineering
  • Customizable task types and code styles
  • No vendor lock-in or per-feature paywalls
  • A faster loop between idea → implementation → iteration

More than that — this is how I think now.
Years of system architecture and even more years of playing Voodoo Castle and Pirate's Cove text-adventure games trained me to ask:

“What if this works?”

And these days, more often than not —
it does.


Coming Soon: gpt-bridge

I’m turning this into a small open-source scaffold (eventually; probably):

gpt-bridge — a local-first VS Code extension that connects to your running ChatGPT tab via clipboard, WebView, or local socket.

It’ll be dead simple:

  • Select code → run task → receive structured completion
  • All through your browser session

If you want in early, DM me or drop your email.
And if you’re building weird AI tooling — let’s talk.


🧠 Signal Dispatch is where I write about systems, AI workflows, and how software is changing.
📡 Subscribe if you're into technical curiosity with just enough reflection to keep it human.