Back to articles
I built a 250-tool AI API on a Raspberry Pi 5 — architecture, economics, and what I learned

I built a 250-tool AI API on a Raspberry Pi 5 — architecture, economics, and what I learned

via Dev.to PythonDamien

Six months ago I started building an AI tool API in my apartment. The idea: I was paying $60/month across OpenAI, Anthropic, and various scraping tools — using maybe 2% of what I paid for. Why isn't there a pay-per-call option? So I built one. AiPayGen is a single API with 250+ pre-built tools and 15 AI models from 7 providers. You call /research , /scrape_website , /sentiment , /translate — not raw model completions. Pay per call, starting at $0.004. The Architecture Client -> Cloudflare Tunnel -> Gunicorn (2 workers, 4 threads) -> Flask app -> Model Router -> [Anthropic|OpenAI|Google|DeepSeek|xAI|Together] -> SQLite (WAL mode) for everything: auth, billing, memory, job queue Why SQLite? One file, zero config, WAL mode handles concurrent reads. At my scale (< 1000 req/day), it outperforms Postgres by eliminating network round trips. The entire billing system is atomic deductions in SQLite. Why Flask? I know it. Shipping speed > perfect architecture for a solo project. The Model Router

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
8 views

Related Articles