plano/demos/use_cases/chatgpt-preference-model-selector/README.md
Salman Paracha c0748718f1
Salmanap/chrome extension routing (#511)
* first commit of the chatGPT selector

* stashing changes as checkpoint

* pending changes for chrome extension

* commiting a working version

* converting conversation into messages object

* working version of the extension

* working version with fixed styling and better tested

* fixed the issue that the drop down was too small, and fixed the issue where the route was not displayed on the screen

* updating folder with README.md

* fixes for default model, and to update the manifest.json file

* made changes to the dark mode. improved styles

* fix installation bug

* added dark mode

* fixed default model selection

* fixed the scrolling issue

* Update README.md

* updated content.js to update the labels even when default model

* fixed readme

* upddated the title of the packag

* removing the unnecessary permissions

---------

Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-329.local>
Co-authored-by: cotran <cotran2@utexas.edu>
Co-authored-by: Shuguang Chen <54548843+nehcgs@users.noreply.github.com>
2025-07-08 16:16:32 -07:00

116 lines
3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🗝️ RouteGPT (Beta)
**RouteGPT** is a dynamic model selector Chrome extension for ChatGPT. It intercepts your prompts, detects the user's intent, and automatically routes requests to the most appropriate model — based on preferences you define. Powered by the lightweight [Arch-Router](https://huggingface.co/katanemo/Arch-Router-1.5B.gguf), it makes multi-model usage seamless.
Think of it this way: changing models manually is like shifting gears on your bike every few pedals. RouteGPT automates that for you — so you can focus on the ride, not the mechanics.
---
## 📁 Project Name
Folder: `chatgpt-preference-model-selector`
---
## 🚀 Features
* 🧠 Preference-based routing (e.g., "code generation" → GPT-4, "travel help" → Gemini)
* 🤖 Local inference using [Ollama](https://ollama.com)
* 📙 Chrome extension interface for setting route preferences
* ⚡ Runs with [Arch-Router-1.5B.gguf](https://huggingface.co/katanemo/Arch-Router-1.5B.gguf)
---
## 📦 Installation
### 1. Clone and install dependencies
```
git clone https://github.com/katanemo/archgw/
cd demos/use_cases/chatgpt-preference-model-selector
```
### 2. Build the extension
```
npm install
npm run build
```
This will create a `build/` directory that contains the unpacked Chrome extension.
---
## 🧠 Set Up Arch-Router in Ollama
Ensure [Ollama](https://ollama.com/download) is installed and running.
Then pull the Arch-Router model:
```
ollama pull hf.co/katanemo/Arch-Router-1.5B.gguf:Q4_K_M
```
### 🌐 Allow Chrome to Access Ollama
Start Ollama with appropriate network settings:
```
OLLAMA_ORIGINS=* ollama serve
```
This:
* Sets CORS to allow requests from Chrome
---
## 📩 Load the Extension into Chrome
1. Open `chrome://extensions`
2. Enable **Developer mode** (top-right toggle)
3. Click **"Load unpacked"**
4. Select the `build` folder inside `chatgpt-preference-model-selector`
Once loaded, RouteGPT will begin intercepting and routing your ChatGPT messages based on the preferences you define.
---
## ⚙️ Configure Routing Preferences
1. In ChatGPT, click the model dropdown.
2. A RouteGPT modal will appear.
3. Define your routing logic using natural language (e.g., `brainstorm startup ideas → gpt-4`, `summarize news articles → claude`).
4. Save your preferences. Routing begins immediately.
---
## 💸 Profit
RouteGPT helps you:
* Use expensive models only when needed
* Automatically shift to cheaper, faster, or more capable models based on task type
* Streamline multi-model workflows without extra clicks
---
## 🧪 Troubleshooting
* Make sure Ollama is reachable at `http://localhost:11434`
* If routing doesnt seem to trigger, check DevTools console logs for `[ModelSelector]`
* Reload the extension and refresh the ChatGPT tab after updating preferences
---
## 🧱 Built With
* 🧠 [Arch-Router (1.5B)](https://huggingface.co/katanemo/Arch-Router-1.5B.gguf)
* 📙 Chrome Extensions API
* 🛠️ Ollama
* ⚛️ React + TypeScript
---
## 📜 License
Apache 2.0 © Katanemo Labs, Inc.