I wanted to use my existing ChatGPT and Gemini browser sessions from developer tools such as VS Code without managing separate API keys, model subscriptions, and provider-specific integrations.
That led me to build Chat Model Relay.
It is a self-hosted, experimental gateway that connects an IDE client to a logged-in browser session:
VS Code → Chat Model Relay → ChatGPT or Gemini browser session
The gateway exposes familiar API endpoints while the provider interaction happens through a persistent browser session.
The project is designed primarily for VS Code. Other compatible clients may work, but should be tested individually.
Clone the repository:
git clone https://github.com/dongido001/chat-model-relay.git
cd chat-model-relay
Create the local environment file:
cp .env.example .env
Start the services:
docker compose up -d
Then open the browser login pages:
http://localhost:5800
http://localhost:5801
After logging in, verify the gateway:
curl http://localhost:8650/healthz
You should receive:
{"status":"ok"}
A basic request looks like this:
curl http://localhost:8650/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "catgpt-browser",
"messages": [
{
"role": "user",
"content": "Explain this function"
}
]
}'
In VS Code:
Chat Model Relay.
http://localhost:8650/v1
catgpt-browser
If authentication is enabled, add the API key configured in .env.
This project is aimed at local experimentation with services that users already access through browser accounts. It can be useful for testing IDE workflows, prompt handling, file uploads, and compatibility layers without immediately building a separate provider integration for every service.
That approach also introduces limitations. Browser layouts can change, login sessions can expire, provider behavior can vary, and browser automation is slower and less predictable than a native API.
The stream=true option is accepted for client compatibility, but browser generation completes before the gateway emits the response chunks. It is not live token streaming from the provider.
One useful feature is the long-prompt fallback. When a prompt is too large for the browser composer, the gateway can upload it as a temporary UTF-8 attachment and submit a shorter request referring to that attachment.
This avoids freezing the composer, but adds upload time and depends on the provider accepting file uploads.
Chat Model Relay is experimental software for personal testing. It is not an official ChatGPT or Gemini API, and it should not be exposed publicly without appropriate authentication and network controls.
Use it at your own risk, follow each provider’s terms, and never commit credentials or expose a logged-in browser session.
The project is available here:
github.com/dongido001/chat-model-relay
I’m especially interested in feedback from people using local gateways with VS Code, browser-backed providers, or custom language-model endpoints.