MILAGPT
← All articlesShare:Telegram
MILAGPT · TOKEN SAVINGS

How MILAGPT saves 90% on AI tokens

A real optimisation story: from $100/month to $10-15. No loss of quality.

~8 min read 7 optimisations -90% costs

The problem · An AI assistant is expensive

You set up OpenClaw, connected Telegram, wrote the workspace files. Everything works. And then the bill from Anthropic arrives: $150 for the month.

Out of the box, standard OpenClaw uses one model for everything — usually Claude Sonnet. That means:

  • Every heartbeat (the "is the assistant alive?" check) is Sonnet. That's $3 per million input tokens.
  • Every subagent (a parallel task) is Sonnet too.
  • Every message starts by loading the entire workspace into the context. For a typical user that's 45+ KB of text — about 15,000 tokens.
  • Heartbeats run every 3-4 hours, even if nothing has happened.

The upshot: you pay $3-5 a day just for the assistant to exist. Add real work — and $100-300/month adds up easily.

Our experience · Real numbers

MILAGPT is a personal AI assistant built on OpenClaw, which we're building for ourselves and our clients. Domain: milagpt.io.

When we added up the costs, the picture looked like this:

Cost itemCost/month
Heartbeats (Sonnet, every 3-4 hours)$15-25
Subagents (Sonnet, parallel tasks)$20-40
Bootstrap context (45 KB on every message)$30-50
Working requests (real tasks)$30-80
Total$100-200

Two thirds of the costs aren't work, they're overhead.

We spent a day on optimisation. The result:

Cost itemBeforeAfter
Heartbeats$15-25$0 (Ollama)
Subagents$20-40$2-4 (Haiku)
Bootstrap context$30-50$15-25 (-53%)
Working requests$30-80$30-80
Total$100-200$10-30

7 optimisations · Built into MILAGPT

#1

Multi-model routing

The most powerful optimisation. Instead of one model for everything, each task gets a suitable model:

  • Sonnet 4.5 — for the main tasks (code, analysis, creative work)
  • Haiku 4.5 — for routine and subagents ($0.25/M vs $3/M — 12 times cheaper)
  • Ollama llama3.2 — for heartbeats (free, local)

A heartbeat doesn't need Sonnet — it needs to check a couple of files and reply "all ok". Haiku handles this perfectly.

Savings: 40-50% of total costs.

#2

Free heartbeats on Ollama

Heartbeats are background checks. Every 3-4 hours the assistant wakes up and checks mail, calendar, GitHub. If there's nothing important, it replies "HEARTBEAT_OK".

In standard OpenClaw this is Sonnet — $3 per million tokens. In MILAGPT, heartbeats run on Ollama llama3.2:3b — a 2 GB model that runs locally. Cost: zero.

Savings: $15-25/month → $0.

#3

A compressed workspace (20 KB instead of 45+)

Every message to the assistant starts by loading the workspace files into the context. We audited every file:

  • Removed duplicates between files
  • Archived old memory (MEMORY.md: 22 KB → 4.4 KB)
  • Shortened AGENTS.md (7.8 KB → 2.3 KB) and SOUL.md (7.2 KB → 4.2 KB)
  • Simplified HEARTBEAT.md (4.8 KB → 1.6 KB)

Result: 45 KB → 20 KB, saving ~53% of input tokens on every message.

#4

The bootstrapMaxChars limit

One line in the config that caps the size of the bootstrap context:

"bootstrapMaxChars": 12000

If the workspace grows, OpenClaw will trim it instead of loading all of it. Insurance against accidental bloat.

#5

Token Efficiency instructions in the system prompt

In SOUL.md we added a Token Efficiency block:

  • Answer briefly. Don't repeat the context back.
  • For heartbeats: if there's nothing to report → only HEARTBEAT_OK
  • Don't retell files — use links.
  • Group checks: one message instead of several.

The model generates fewer output tokens. A small thing, but over a month it adds up.

#6

Automatic session cleanup

Every session is saved to a .jsonl file. Over a month that's hundreds of megabytes. MILAGPT includes a cleanup-sessions.sh script that archives old sessions and deletes the originals.

A clean system is a fast system.

#7

A fallback chain for rate limits

Under high load, the Anthropic API returns rate limit errors. Standard OpenClaw just waits. MILAGPT automatically switches to a fallback model:

Sonnet (rate limit) → Haiku (cheaper and more available)

You don't lose time waiting, and you pay less for the fallback requests.

Comparison · OpenClaw vs MILAGPT

ParameterOpenClaw (standard)MILAGPT
Model for everythingSonnet ($3/M input)Multi-model routing
Heartbeat modelSonnet ($3/M input)Ollama llama3.2 (free)
Subagent modelSonnet ($3/M input)Haiku ($0.25/M input)
Bootstrap context45+ KB (~15K tokens)20 KB (~7K tokens)
bootstrapMaxCharsUnlimited12,000 characters
Token Efficiency promptNoBuilt in
Session cleanupManualAutomatic script
Fallback on rate limitWaitingAuto-switch
Idle cost/day$2-5$0
Cost/month$100-300$10-30

Why · It matters

An AI assistant is an everyday tool. If it costs $200/month, you'll think twice before every message. If it's $10-15, you simply use it freely.

MILAGPT was created to make an AI assistant affordable. None of the optimisations are separate settings you have to fiddle with. They're built into the product and work out of the box.

Try MILAGPT

All 7 optimisations are already switched on. You don't need to figure out model routing, install Ollama by hand or compress workspace files.

A personal AI assistant that runs on your Mac via Telegram. With optimised costs and a Russian-language interface.

MILAGPT · Tashkent

Want a digital employee like this for yourself?

Write to Mila: she replies in seconds, at any time of day or night.

Write to Mila →
Mila · MILAGPT

Get your own Mila

Tell her about your business in Telegram and she'll help from the very first conversation.

Get your own Mila →
← All blog articles