DEV Community

Cover image for How I Built a 100% Free, Hybrid AI Copilot for MS Word (Using Python & Groq)
Ayoola Damisile
Ayoola Damisile

Posted on

How I Built a 100% Free, Hybrid AI Copilot for MS Word (Using Python & Groq)

How many times have you been working on a massive document in Microsoft Word, doing the exact same repetitive edits over and over, wishing you had an AI to just handle it?

The obvious solution is Microsoft 365 Copilot. The problem? It costs $360 a year, and if you are on an older, standalone version of Office, it doesn't even support it.

As a developer, I refuse to pay for something I can build myself. So, I decided to engineer my own AI Assistant for Wordβ€”a lightweight, open-source Windows companion that sits right beside MS Word and gives you conversational AI powers directly inside your documents.
**

GitHub logo Ayoola-tech2024 / ai-assistant-for-word

Your AI assistant for Microsoft Word β€” talk to Word in plain English. Draft, refine, format, research. Free.

πŸ“„ AI Assistant for Word

The 100% Free, Open-Source Alternative to Microsoft 365 Copilot

Talk to Microsoft Word in plain English. Fast, private, and works offline.

GitHub Stars Platform Word License: MIT Cost Python


⬇️ Download Portable App (.ZIP) β€’ πŸ“– How To Use β€’ ✨ Features β€’ πŸ’‘ Why Star This?


⚑ Why Pay $360/Year for Copilot?

Microsoft charges $20 to $30 per month ($360/year) for Microsoft 365 Copilot. AI Assistant for Word gives you the exact same conversational coworker experience inside your desktop Word application for $0, powered by high-speed free AI engines and a lightning-fast offline automation core.

Feature Microsoft 365 Copilot AI Assistant for Word
Annual Cost $240 – $360 / year $0 (100% Free Forever)
Account Requirement M365 Business / Pro Sub Any Word 2013, 2016, 2019, 2021, or 365
Offline Execution ❌ None (Cloud only) βœ… Instant Local Heuristics Engine (0.001s)
Safety & Control Overwrites without approval βœ… Strict Preview &
…

**
Here is how I built it, how the architecture works, and how you can use it for free.

πŸ› οΈ The Tech Stack

To make this work flawlessly on Windows without requiring a heavy web browser, I kept the stack lightweight and brutally fast:

Language: Python
Document Control: pywin32 (Windows COM API)
AI Engine: Groq (for blazing-fast, 0ms latency inference) & Google Gemini
Voice Dictation: Groq Whisper
UI/Packaging: Standalone executable (No Python installation required for end-users)
πŸ—οΈ How It Works Under the Hood

  1. Controlling Word via pywin32

The hardest part wasn't the AI; it was getting an external script to talk to a live, running instance of Microsoft Word. I used Python’s win32com.client to hook directly into Word's active COM (Component Object Model) interface.

This allows the app to read the selected text, inject new paragraphs, and even format tables and charts programmatically, entirely in the background.

python
import win32com.client
# Hook into the active MS Word application
word_app = win32com.client.Dispatch("Word.Application")
doc = word_app.ActiveDocument
selection = word_app.Selection
# Example: Inject AI generated text at cursor
def inject_text(text):
    selection.TypeText(text)
Enter fullscreen mode Exit fullscreen mode
  1. The Hybrid Execution Engine

One of my biggest pet peeves with cloud AI tools is that they require an internet connection for everything.

I built a Hybrid Engine. If you ask the assistant to "Resize all fonts to 12pt Arial," "Align center," or "Export to PDF," the request bypasses the LLM entirely and executes locally in 0ms using native COM commands.

It only reaches out to Groq or Gemini when you need heavy lifting: drafting a proposal, translating text, or doing live web research.

  1. The "Safety-First" Preview Loop

If you’ve ever used an AI coding assistant, you know the terror of it hallucinating and deleting half your codebase. I didn't want that happening to important documents.

I engineered a Safety-First Preview Loop. The AI is never allowed to modify your document directly without permission. Every action outputs a plain-English preview first. You review the output, and only when you click "Yes, do it," does it inject the changes into Word. Made a mistake? A native 1-click Undo restores everything.

  1. The Markdown Cleaner

LLMs natively output Markdown (asterisks for bold, hashtags for headers). If you inject raw Markdown into MS Word, it looks terrible.

I wrote a custom parsing layer that strips raw # and ** symbols and translates them into native MS Word rich-text formatting (Bold, H1, H2, etc.) before the text ever touches the document canvas.

πŸš€ The Result

The final product is a polyglot, voice-activated AI companion that can: βœ… Draft formal letters based on short prompts. βœ… Run live web research and insert cited statistics. βœ… Translate documents into 50+ languages while preserving exact formatting. βœ… Act as a human editor with Copilot-style margin comment balloons.

πŸ’» Try it out (100% Free & Open Source)

I open-sourced the entire project on GitHub. You don't even need to have Python installedβ€”you can just download the standalone Windows app, unzip it, and start working immediately.

If you find it useful, I would love a star on the repository! Let me know in the comments what features you would want to see next.

GitHub logo Ayoola-tech2024 / ai-assistant-for-word

Your AI assistant for Microsoft Word β€” talk to Word in plain English. Draft, refine, format, research. Free.

πŸ“„ AI Assistant for Word

The 100% Free, Open-Source Alternative to Microsoft 365 Copilot

Talk to Microsoft Word in plain English. Fast, private, and works offline.

GitHub Stars Platform Word License: MIT Cost Python

⬇️ Download Portable App (.ZIP) β€’ πŸ“– How To Use β€’ ✨ Features β€’ πŸ’‘ Why Star This?



⚑ Why Pay $360/Year for Copilot?

Microsoft charges $20 to $30 per month ($360/year) for Microsoft 365 Copilot. AI Assistant for Word gives you the exact same conversational coworker experience inside your desktop Word application for $0, powered by high-speed free AI engines and a lightning-fast offline automation core.































Feature Microsoft 365 Copilot AI Assistant for Word
Annual Cost $240 – $360 / year $0 (100% Free Forever)
Account Requirement M365 Business / Pro Sub Any Word 2013, 2016, 2019, 2021, or 365
Offline Execution ❌ None (Cloud only) βœ… Instant Local Heuristics Engine (0.001s)
Safety & Control Overwrites without approval βœ… Strict Preview &
…





damisile

About the Author Ayoola Damisile

is a Full-Stack Software Engineer & Open Source Architect. Connect with me on LinkedIn here
or check out my other projects at www.damisile.name.ng
.

Top comments (0)