Skip to content

Krishcode264/llm-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌌 llm-client (v2.0)

llm-client is a local Node.js service that turns your existing ChatGPT, Claude, and Gemini browser sessions into a free structured JSON API — no API keys, no cost, no limits.


✨ Key Features

  • ⚖️ Smart Load Balancing: Automatically rotates requests across available LLMs (Round-Robin) to maximize throughput and avoid rate limits.
  • 🧬 Multi-Provider Parallelism: Dynamically manages isolated browser sessions for ChatGPT, Claude, and Gemini simultaneously.
  • 🛡️ Anti-Detection Engine: Built on Playwright with advanced stealth plugins to bypass automation detection.
  • 🔄 Self-Correction Pipeline: Built-in Zod validation that automatically re-prompts the LLM with error details if the JSON output is invalid.
  • 💾 Persistent Sessions: Saves browser profiles locally—log in once, stay logged in across restarts.
  • 📦 Schema-Driven: Simply provide a JSON object defining your desired structure, and llm-client handles the rest.

🏗️ Architecture

graph TD
    User["/api/v1/balanced/transform"] --> Pool["SessionPool"]
    Pool --> Rotator["Round-Robin Balancer"]
    Rotator --> P1["ChatGPT Adapter"]
    Rotator --> P2["Claude Adapter"]
    Rotator --> P3["Gemini Adapter"]
    
    P1 --> B1["Browser Window 1"]
    P2 --> B2["Browser Window 2"]
    P3 --> B3["Browser Window 3"]
Loading

🚀 Getting Started

1. Prerequisites

  • Node.js (v18+)
  • npm or pnpm
  • Google Chrome or Chromium installed

2. Installation

git clone https://github.com/your-repo/llm-client.git
cd llm-client
npm install
npx playwright install chromium

3. Configuration (.env)

Create a .env file in the root directory:

PROVIDERS=chatgpt,claude,gemini
HEADLESS=false
PORT=3333

🚦 Usage

Starting the Server

npm run dev

Important

On the first run, keep HEADLESS=false. Windows will pop up for each provider. Log in to your accounts manually. These sessions will be saved in ./browser-profile.

📑 API Examples

Balanced Request (Recommended)

Automatically picks the next available provider.

curl -X POST http://localhost:3333/api/v1/balanced/transform \
  -H "Content-Type: application/json" \
  -d '{
    "task": "Extract product details",
    "schema": { "name": "string", "price": "number" },
    "input": "The Gadget is $99. It is waterproof."
  }'

🛠️ Endpoints Reference

Endpoint Method Description
/:provider/transform POST Single transformation using a specific provider.
/balanced/transform POST Smart round-robin transformation.
/:provider/batch POST Process multiple inputs sequentially.
/queue/status GET View pending/processing tasks across all workers.
/session/status GET Check if providers are logged in and ready.
/:provider/rescue POST Capture a screenshot of a browser session (for debug).

📂 Project Structure

├── src/
│   ├── adapters/     # LLM provider implementations
│   ├── browser/      # Session pooling and browser management
│   ├── routes/       # API endpoint handlers
│   ├── queue/        # Concurrency & worker logic
│   ├── validator/    # Schema validation & retry pipeline
│   └── templates/    # System prompts & extraction templates
├── browser-profile/  # Persisted login data (Git-ignored)
└── .env              # Global configuration

⚖️ Disclaimer

This project is for educational or automation purposes. Ensure your usage complies with the Terms of Service of the respective LLM providers.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors