Skip to content

Repository files navigation

πŸš€ CodaiPro v3.0 (Codai Pro) - Offline AI Coding Assistant

CodaiPro Logo Open Source Offline Ready Student Friendly

🌟 A private, offline AI coding assistant that runs the official llama.cpp engine and opens in your browser

Built for lab exams, coding competitions, and any room where the network is off limits

πŸ“₯ Download Latest Release β€’ 🌐 Website β€’ πŸ“– Model Guide


What changed in v3.0

The desktop GUI is gone. CodaiPro now runs the official llama-server engine from llama.cpp with a fast browser chat UI β€” streaming answers token by token, markdown rendering, code copy buttons, a stop button, and a controller that watches the engine and restarts it if it crashes. One folder, one script, no Python GUI toolkits, no heavyweight dependencies.

Codai architecture

✨ Why CodaiPro?

  • 100% Offline β€” inference happens on your CPU; nothing leaves the machine
  • Real llama.cpp engine β€” llama-server with streaming, not a Python wrapper
  • Browser UI β€” ChatGPT-style chat with markdown and code blocks, opened automatically
  • Self-healing β€” engine health monitor, auto-restart, stale lock recovery, crash reports
  • Hardware-aware β€” RAM/CPU tiers tune context size and threads automatically
  • Portable β€” one folder on a USB stick; run.bat does everything

πŸš€ Quick Start (Windows)

1. Download the portable zip from releases and unzip to a writable folder
2. Drop ONE .gguf model into the models/ folder (default: gemma-3-1b-it-Q4_K_M.gguf)
3. Double-click run.bat
4. Wait for [READY] - your browser opens http://127.0.0.1:8081/
5. Press any key in the launcher window to stop Codai safely

The release zip includes Codai.exe and the official engine\llama-server.exe β€” the only thing you add is a model.

🐍 Run from Source (Windows / Linux / macOS)

git clone https://github.com/Luckyyaduvanshiofficial/Codaipro.git
cd Codai

pip install -r requirements.txt   # just psutil

# Windows
run.bat

# Linux / macOS
python dev/controller.py

From source you also need the engine binary in engine/:

  • Windows: winget install llama.cpp, then copy llama-server.exe into engine\ β€” or grab llama-bXXXX-bin-win-cpu-x64.zip from llama.cpp releases
  • Linux: download llama-bXXXX-bin-ubuntu-x64.tar.gz from llama.cpp releases and put llama-server (+ the .so files) into engine/
  • macOS: use the llama.cpp release binaries or brew install llama.cpp, then symlink llama-server into engine/

🧠 Downloading a Model

CodaiPro runs a local GGUF model. Drop one .gguf file into the models/ folder. The default expected by config.json is Gemma 3 1B β€” using a different file? Set "model_name" in config.json (or run DOWNLOAD_MODEL.bat).

Weak lab PC? Take a tiny one β€” under 1 GB, runs on almost anything:

Model Size Direct download (Q4_K_M)
Gemma 3 1B Instruct (default) 0.81GB Download Β· Model page
Qwen3.5-0.8B (newest) 0.58GB Download Β· Model page
Qwen3-0.6B 0.48GB Download Β· Model page
Llama 3.2 1B Instruct 0.81GB Download Β· Model page

The Qwen 3 family thinks before it answers; the engine keeps the scratchpad out of your way.

When 2 GB is fine β€” a better coder:

Model Size Best For Source
Phi-3.5-mini ⭐ 2.3GB Best speed/quality balance microsoft/Phi-3.5-mini-instruct-gguf
Qwen2.5-Coder-3B 2GB Fast coding on low-spec machines Qwen/Qwen2.5-Coder-3B-Instruct-GGUF
Qwen2.5-Coder-7B 4.7GB Most powerful (q4_k_m) Qwen/Qwen2.5-Coder-7B-Instruct-GGUF
  • Pick the q4 / q4_k_m quantization for the best CPU performance.
  • If a model downloads as split parts, keep all parts together in models/.
  • Chat templates are applied by the engine from the model metadata β€” every model above just works.

πŸ—οΈ Architecture

CodaiPro/
β”œβ”€β”€ dev/
β”‚   β”œβ”€β”€ config.py       # config, constants, paths, env overrides
β”‚   β”œβ”€β”€ controller.py   # orchestrator: lifecycle, logging, shutdown
β”‚   β”œβ”€β”€ engine.py       # llama-server process + health monitor + restart
β”‚   β”œβ”€β”€ proxy.py        # serves the UI, forwards API, streaming, telemetry
β”‚   └── system.py       # hardware analysis (RAM/CPU tiers)
β”œβ”€β”€ engine/             # llama-server binary (downloaded, not in git)
β”œβ”€β”€ models/             # your .gguf model (not in git)
β”œβ”€β”€ ui/                 # browser chat UI (index.html, app.js, styles.css)
β”œβ”€β”€ config.json         # port, model name, debug
β”œβ”€β”€ run.bat             # Windows launcher
└── kill.bat            # force-clean processes and locks
  • Controller starts the proxy, boots the engine, tracks lifecycle phases, performs graceful shutdown
  • Proxy serves ui/ and forwards /v1/chat/completions to the engine with request IDs, queue control, and SSE streaming
  • Engine manager validates the binary, waits for readiness, monitors health every 5s, auto-restarts up to 3 times
  • Ports: UI 8081, engine 8082 (from config.json or CODAI_PORT)

βš™οΈ Configuration

{
  "port": 8081,
  "model_name": "gemma-3-1b-it-Q4_K_M.gguf",
  "ctx": 2048,
  "threads": 4,
  "host": "127.0.0.1",
  "debug": false,
  "log_level": "INFO"
}

Environment overrides: CODAI_PORT, CODAI_MODEL, CODAI_CTX, CODAI_THREADS, CODAI_HOST, CODAI_DEBUG, CODAI_LOG_LEVEL. Priority: environment > config.json > hardware-derived defaults.

Logs land in logs/codai.log, logs/engine.log, logs/crash.log. Debug mode ("debug": true) also exposes /logs and the /telemetry page.

πŸ› οΈ Technical Specifications

  • OS: Windows 10/11 (64-bit) for the packaged release; Linux/macOS from source
  • RAM: 4GB minimum, 8GB recommended
  • Storage: ~1GB for the app + 0.5–5GB for one model
  • Runtime: Python 3.10+ with psutil (source mode only), llama.cpp llama-server engine
  • UI: your browser β€” no GUI toolkit, no Electron, no internet

Key Technologies

  • Streaming chat over SSE with stop support
  • Engine health monitor with staged auto-restart (0s / 2s / 5s backoff)
  • Hardware-aware tuning β€” context and threads scale to the machine
  • Single instance β€” PID lock with stale-lock recovery
  • Rotating logs + crash reports in logs/

🀝 Contributing

See CONTRIBUTING.md and the developer deep-dive in docs/contributor-project-info.md. Bug reports and model-compatibility reports are very welcome via issues.

πŸ‘¨β€πŸ’» About the Developer

Lucky Yaduvanshi

Full-Stack Developer & DevOps Enthusiast

Portfolio GitHub

"Building tools that make coding accessible to everyone, everywhere."

Why I Built CodaiPro

As a student, I experienced firsthand the frustration of lab environments without internet access. During crucial exams and projects, when you need coding assistance the most, traditional AI tools are unavailable. CodaiPro solves this by bringing powerful AI assistance directly to your machine β€” no internet required.

πŸ“„ License

Licensed under the MIT License β€” see the LICENSE file.

πŸ™ Acknowledgments

  • llama.cpp team β€” for the incredible llama-server engine
  • bartowski & model publishers β€” for the quantized GGUF models
  • Open Source Community β€” for inspiration and support

πŸ“ž Support & Contact


🌟 Star this repository if CodaiPro helped you!

Made with ❀️ for the coding community

About

CodaiPro runs a real language model on your own machine. No internet, no accounts, no API keys. Made for lab exams.

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages