Skip to content

BOT-HARI-01/LLMBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 LLMBridge

Turn your browser into a programmable, zero-cost API for ChatGPT & Gemini.

LLMBridge is a high-performance developer tool that creates a secure bi-directional tunnel between your local scripts and web-based LLMs. Skip the expensive API tokens and rate limits by using your browser as the automated "brain" for your projects.


📺 Demo: See it in Action

LLMBridgeDemo.mp4

How it works: A local Node.js or Python script sends a request via HTTP; the bridge routes it to the browser; the AI types the response, and the final data is returned to your terminal in seconds.


✨ Key Features

  • Zero Cost: No OpenAI or Google Cloud API keys required.
  • Dual-Model Support: Works natively with both ChatGPT and Gemini.
  • Structured Data: Built-in tools to force LLMs into returning valid, parseable JSON.
  • Universal Access: Access the bridge from JavaScript, Python, or any language that supports HTTP.

🏗️ Architecture

LLMBridge is split into two primary layers:

  1. /extension: The Chrome Extension that manages the browser automation and scrapes response data.
  2. /extSys: The Native Host (Node.js) that acts as a local HTTP server and handles the stdin/stdout pipe to Chrome.

🛠️ Installation & Setup

Watch the Setup Guide

LLMBridgeSetup.mp4

Step-by-Step

  1. Load Extension: Open chrome://extensions/, enable Developer Mode, and click Load Unpacked. Select the /extension folder.
  2. Copy ID: Copy the Extension ID generated by Chrome.
  3. Register Host: Open a terminal in the project root and run .\setup.ps1. Paste your Extension ID when prompted to register the bridge in the Windows Registry.
  4. Connect: Open ChatGPT or Gemini, click the extension icon, and hit Connect Native Host.

🔌 Developer API

LLMBridge is designed to be completely modular. You can use our provided helper library or call the endpoint directly with your own logic.

The Raw Endpoint

If you prefer to handle your own prompt engineering, you can hit the local server directly:

  • Method: POST
  • URL: http://localhost:3000/prompt
  • Body: {"prompt": "Your custom text here"}

Modular Prompting (Optional)

Our llmClient library (found in /Client) includes a buildStrictJSONPrompt function. We use this for modularity—it handles the "boring" parts of prompt engineering, such as:

  • Enforcing double-quote compliance for JSON.
  • Stripping problematic Markdown links and backticks.
  • Formatting the schema for better LLM adherence.

You are free to construct your own prompts. If you prefer raw strings or your own template engine, simply pass them directly to the askLLM function.

Example: Structured JSON Mode

import { askLLM, buildStrictJSONPrompt } from './Client/llmClient.js';

// 1. Define your goal & structure
const myTask = {
  task: "Extract contact info",
  context: "Email me at dev@example.com",
  schema: { email: "string" }
};

// 2. Build (Optional) and Send
const prompt = buildStrictJSONPrompt(myTask); 
const response = await askLLM(prompt);

// 3. Use like a real API
const data = JSON.parse(response.data);
console.log(data.email);

⚠️ Important Requirements

  • Keep the Tab Active: An AI tab (ChatGPT or Gemini) must remain open for the bridge to function. The extension acts as a human proxy—if the tab is closed, the bridge cannot send input.
  • Permissions: This tool uses nativeMessaging for local communication and scripting for browser automation.

⚖️ License

Distributed under the MIT License. Created for research, education, and personal automation.

About

Turn your browser into a programmable API. LLMBridge connects your local scripts to ChatGPT and Gemini using Chrome Native Messaging.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors