2

Show HN: Dracula-AI – A lightweight, async SQLite-backed Gemini wrapper

I'm an 18-year-old CS student from Turkey. I've been building Dracula, a Python wrapper for the Google Gemini API. I initially built it because I wanted a simpler Mini SDK that handled conversational memory, function calling, and streaming out of the box without the boilerplate of the official SDK.

Recently, I got some well-deserved technical criticism from early users: using JSON files to store chat history was a memory-bloat disaster waiting to happen; forcing a PyQt6 dependency on server-side bots was a terrible design choice; and lacking a retry mechanism meant random 503s from Google crashed the whole app.

So, I went back to the drawing board and completely rewrote the core architecture for v0.8.0. Here is what I changed to make it production-ready:

Swapped JSON for SQLite: I implemented a local database system (using sqlite3 for sync and aiosqlite for async). It now handles massive chat histories without eating RAM, and tracks usage stats safely.

True Async Streaming: Fixed a generator bug that was blocking the asyncio event loop. Streaming now yields chunks natively in real-time.

Exponential Backoff: Added an under-the-hood auto-retry mechanism that gracefully handles 429 rate limits and 503/502 server drops.

Zero Bloat: Split the dependencies. "pip install dracula-ai" installs just the core for FastAPI/Discord bots. "pip install dracula-ai[ui]" brings in the desktop interface.

Here is a quick example of the async streaming:

import os, asyncio from dracula import AsyncDracula

async def main(): async with AsyncDracula(api_key=os.getenv("GEMINI_API_KEY")) as ai: async for chunk in ai.stream("Explain quantum computing"): print(chunk, end="", flush=True)

asyncio.run(main())

Building this has been a huge learning curve for me regarding database migrations, event loops, and package management. I would love for the HN community to look at the code, review the async architecture, and tell me what I did wrong (or right!).

GitHub: https://github.com/suleymanibis0/dracula PyPI: https://pypi.org/project/dracula-ai/

Thanks for reading!