Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨ Apollo - system-wide AI shortcut

Apollo is intended to be an entire system manager with a fleet of functions letting it perform nearly every task on your PC. Currently, it's a lightweight Windows background process that intercepts your keystrokes globally. Type @apo followed by any prompt and close it with @@ — Apollo instantly replaces your text with a real ChatGPT response, in any application, without switching windows.


✨ Demo

Demo vid

In a Word Document:

Word vid

In an IDE:

IDE vid


🗺️ How It Works

┌─────────────────────────┐               stdin/stdout            ┌───────────────────────────┐
│   C# Background App     │  ──────────────────────────────────▶ │  Python Engine            │
│  (Global Keyboard Hook) │      prompt text (plain UTF-8)        │  (Playwright + ChatGPT)   │
│                         │ ◀─────────────────────────────────── │                           │
│   Clipboard / SendKeys  │       base64-encoded AI response      │  Automates chatgpt.com    │
└─────────────────────────┘                                       └───────────────────────────┘

I've used browser automation to get past API costs to make it free to use.

1. Global Keyboard Hook (C#)

  • Runs silently in the background using a Windows low-level keyboard hook (SetWindowsHookEx)
  • Monitors every keystroke system-wide without interfering with normal typing
  • When it detects the sequence @apo ... @@, it:
    1. Uses clipboard + SendKeys to select and extract your prompt text
    2. Replaces it with processing... as a visual placeholder
    3. Fires the prompt to the Python engine
    4. Pastes the full AI response back exactly where your cursor was

2. Python AI Engine

  • Launches a persistent Microsoft Edge browser (via Playwright) pointed at chatgpt.com where you can login(just the first time), or without login it works in guest mode by default.
  • Keeps the browser session alive and minimized for the lifetime of the app — no re-setup each time
  • Receives prompts from C# over stdin, submits them to ChatGPT, waits for the full response, and returns it over stdout encoded in base64 (to safely handle newlines and special characters)
  • Sends a READY signal to C# once the browser has fully loaded, so nothing fires before the engine is up

⌨️ Usage

Step What you type What happens
Trigger @apo Apollo starts listening for your prompt
Prompt summarise this in 3 bullet points Normal typing, captured silently
Submit @@ Apollo selects the block, sends it to GPT, pastes the response

Works in: Word, Notepad, VS Code, IDEs, browsers, Outlook, chat apps — ANYWHER YOU CAN TYPE.

Note: Apollo uses the clipboard internally during injection. Avoid copying something critical right as @@ is triggered.


🚀 Setup

Requirements

  • Windows 10/11
  • .NET 8 SDK
  • Python 3.x with pip
  • Microsoft Edge (or your default browser)

Step 1 — Install Python dependencies

pip install playwright pyautogui
playwright install

Step 2 — First run (log in to ChatGPT)

On first launch, Edge will open and you'll need to log in to ChatGPT manually. Apollo saves your session in a local chatgpt_profile/ folder — you won't need to log in again after this.

Step 3 — Run Apollo

dotnet run

Or publish a standalone .exe and place apollo_chat.py in the same folder:

dotnet publish -c Release -r win-x64 --self-contained

Apollo will print Apollo is READY. Listening for @apo ... when it's good to go.


📂 Project Structure

Apollo/
├── Program.cs          # C# entry point — keyboard hook, clipboard injection, IPC
├── apollo_chat.py      # Python engine — Playwright browser automation + ChatGPT
├── chatgpt_profile/    # Auto-created: persistent Edge session (keeps you logged in)
└── README.md

⚙️ Technical Notes

  • IPC protocol: C# writes plain UTF-8 prompts to Python's stdin. Python replies with a base64-encoded response followed by @@END_OF_RESPONSE@@ as a delimiter — ensuring multi-line AI responses are transmitted safely.
  • Session persistence: The Edge profile is stored locally in chatgpt_profile/, meaning ChatGPT stays logged in between runs.
  • Prompt extraction: When @@ is detected, Apollo grows a clipboard selection upward line by line until it finds @apo, then surgically extracts just the prompt between those two markers — even across multiple lines.
  • Thread safety: Clipboard operations run on a dedicated STA thread (required by Windows) and an isInjecting flag prevents the keyboard hook from re-entering during paste operations.

⚠️ Limitations

  • ChatGPT's web UI changes occasionally — if it breaks, Playwright selectors in apollo_chat.py may need updating, not a big deal.
  • Large text outputs get confusing to navigate -> a preprompt telling gpt how to format responses for each case may improve legibility, quality and speed of output.
  • Not designed for simultaneous multi-prompt use

About

A system-wide AI keyboard shortcut. Type @apo anywhere, get ChatGPT output pasted right where your cursor is.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages