#36
Cost accounting and cheaper code paths
Draft. Cuts one recorded e2e run (43 agent turns) from ₦967 as main counted it to ₦706, measured offline at ₦0 on the recorded run. Details in COST.md.
| Agent cost | Per turn | Model calls | |
|---|---|---|---|
| Before, as main counted it (cached input at the full rate) | ₦967.48 | ₦22.50 | 117 |
| Before, cached input at Meta's cached rate | ₦769.13 | ₦17.89 | 117 |
| After (defaults) | ₦705.93 | ₦16.42 | 111 |
Of the ₦261.55 drop, ₦198.35 is accounting (cached input priced at $0.15 per 1M, which Meta already bills) and ₦63.20 is real spend cut by the plain-code paths.
What is in it
- One metering seam: router, steer, binding, readers, SAM and speech to text booked to the daily naira cap and the run budget; prices in
mimi/models/prices.py(MIMI_CACHED_RATE=0restores the old accounting). - Plain-code paths (
MIMI_PLAIN_CODE): balance, promo and quiet approvals on by default; delivery receipt and stock paths built but off until a live e2e re-record. Same tools, tiers, Go policy, approvals and claims gate; any surprise hands the step to the model. prompt_cache_keyper shared prefix (body only, recordings replay unchanged).- Shared-prefix context layout behind
MIMI_CTX_SHARED_PREFIX=1, off (needs a live re-record). - Demo kill switch also refuses new and reset sessions.
Measure: META_API_KEY= python -m mimi.api.e2e --no-write (after) and the same with MIMI_PLAIN_CODE=0 (before). No live model calls, no deploy.
Activity
6This pull request is a draft
Merging is unavailable until it is marked ready for review.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.