PixelCode

A self-hosted AI coding assistant that costs $0 to run

View on GitHub

Description


Motivation: Claude Code, Cursor, and GitHub Copilot all cost money. PixelCode does the same job — read, write, run, review, debug, and refactor code across any language — and costs $0 permanently because you own the entire stack.

What it does: Provides a rich CLI interface backed by a FastAPI server. The assistant can read files, write files, list directories, run terminal commands, and remember past sessions via persistent conversation memory. Runs fully offline via Ollama, or on free cloud APIs (Groq, Gemini, OpenRouter) when you need more power.

Provider chain: Requests route through Groq → Gemini → OpenRouter → Ollama in order of preference. If one provider is rate-limited or unavailable, the next one picks up automatically — so the assistant is always responsive.

How it was built: Python is the core language. FastAPI handles the backend API layer. Ollama runs local LLM inference (DeepSeek Coder or CodeLlama). The CLI uses rich for styled terminal output. Memory is stored as plain files so sessions persist across restarts.

Architecture


PixelCode — Provider Chain & Tool Architecture ══════════════════════════════════════════════ CLI (cli.py) FastAPI Backend ────────────── ─────────────── rich terminal UI ◄────────► message router conversation loop tool dispatcher session memory provider chain: 1. Groq (fast, free tier) 2. Gemini (generous quota) 3. OpenRouter (fallback) 4. Ollama (fully offline) Tools available to the model: ┌──────────────┬─────────────────────────────────────┐ │ read_file() │ Auto-routes PDF/Excel/CSV to readers │ │ write_file() │ Write plain text to any path │ │ list_dir() │ Directory listing with file sizes │ │ run_cmd() │ Execute terminal commands │ └──────────────┴─────────────────────────────────────┘ Memory layer: plain files in memory/ — persists across sessions

Dev Notes

Problem Solved

Paid AI coding tools lock you into subscriptions. PixelCode gives you the same agentic loop — read code, reason, write, test — using Ollama for offline inference or free cloud APIs, with no recurring cost.

Technical Highlights

The provider chain means the assistant never goes silent due to rate limits. Tool dispatch lets the model interact with the real filesystem and terminal, not just text — the same capability that makes Claude Code useful.

What's Next

Browser UI via Open WebUI integration, better memory summarization for long sessions, and automatic context injection from CLAUDE.md-style project files.


Back to top