DEV Community

ModelHub Dev
ModelHub Dev

Posted on

Running 18 AI Employees on a $10/Month Budget: The Architecture That Made It Work

Running 18 AI Employees on a $10/Month Budget

Last month I turned a Telegram bot into a team of 18 AI employees — content writers, market watchers, outreach agents, QA testers — all working 24/7. The fun part? The entire API bill is under $10/month.

Here's the architecture, the prompt design, and the cost tricks that made it work.

1. The Architecture: One Bot, Many Workers

The naive approach is one bot with one system prompt. That breaks down fast — a content writer and a risk monitor want completely different behaviors, and they shouldn't share context.

What worked instead:

Telegram Bot (receive commands)
        │
        ▼
Dispatcher (routes by keyword / worker name)
        │
        ├── Worker: content_writer   (system prompt A)
        ├── Worker: market_monitor   (system prompt B)
        ├── Worker: outreach_agent   (system prompt C)
        └── ... 15 more workers
Enter fullscreen mode Exit fullscreen mode

Each worker is just a named system prompt + a small toolset. The dispatcher is ~100 lines of Python. No LangChain, no agent frameworks — plain asyncio and a queue.

Rule #1: Workers never share conversation history. Each one gets a clean context per task. This is what keeps costs linear instead of exponential.

2. The Prompt Design That Saves Tokens

The biggest cost leak in agent systems is context bloat. Three rules that cut my token usage by ~60%:

  • Rule #1: One-shot prompts over multi-turn. Instead of "let's discuss and iterate," the worker gets a complete task spec and returns one answer. Iteration happens in the dispatcher, not in the LLM context window.
  • Rule #2: Structured output. Every worker returns JSON ({done, result, needs_human}). This makes failures detectable programmatically instead of re-prompting.
  • Rule #3: Cold starts. If a task hasn't changed, don't re-run it. Cache results with a TTL. Sounds obvious, but most "AI employee" demos forget it and burn tokens re-generating the same report every hour.

3. The Cost Math

Here's where model choice matters. Using the OpenAI-compatible endpoint on ModelHub, I route each worker to the cheapest model that can handle the job:

Worker type Model Cost per 1M tokens
Content writer DeepSeek V3 $0.28 input / $1.13 output
Market monitor DeepSeek V4 Flash ~10x cheaper than GPT-4o
QA tester DeepSeek R1 $0.287 input

A typical daily load — ~2,000 tasks of ~800 tokens each — costs about $0.30/day total. That's under $10/month for an 18-worker operation. The same load on GPT-4o would be roughly 40-90x that.

from openai import OpenAI

client = OpenAI(
    base_url="https://modelhub-api.com/v1",  # OpenAI-compatible
    api_key=os.environ["MODELHUB_KEY"],
)

resp = client.chat.completions.create(
    model="deepseek-v3",
    messages=[{"role": "system", "content": WORKER_PROMPTS["market_monitor"]},
              {"role": "user", "content": task}],
)
Enter fullscreen mode Exit fullscreen mode

One key, one base_url swap — that's the whole migration story. My old code used openai SDK; I changed two lines and every worker kept working.

4. The Gotchas

  • Rate limits are real. Batch jobs with asyncio.Semaphore(5) and retry with backoff. Don't fire 18 workers at the same second.
  • JSON mode isn't guaranteed. Validate output; re-queue with the error message appended once, then fall back to a human alert.
  • Monitor spend daily. I log tokens per worker to a tiny SQLite table. When a worker's cost spikes, it's usually a runaway loop, not a model problem.

The Takeaway

You don't need an agent framework or a big budget to run AI employees. One Telegram bot, a dispatcher, disciplined prompts, and a cheap OpenAI-compatible API get you 90% of the value for $10/month.

If you want to try the same setup, ModelHub gives you one key for DeepSeek, Qwen, Claude, and 100+ other models — start with free credit here. Happy to answer questions about the architecture in the comments.

Top comments (0)