The current debate about AI badges and reasoning ledgers is asking the wrong question. The useful metric is not whether a post was AI-assisted, but how many tokens each decision cost and what signal they returned. A free 10M token grant makes that question urgent, because unmeasured free spend becomes review debt that lands on humans.
The grant moves cost, it does not remove it
Free model access relocates cost from the API bill to the review queue, and that relocation stays invisible until it hurts. Every generated patch, migration, or test needs a human verdict, and that verdict is the most expensive stage of the pipeline. A grant without a meter is therefore not an asset; it is a liability with a friendly login screen.
The same logic applies to the free server option that ships with MonkeyCode. Disclosure: This article was prepared as part of MonkeyCode's product outreach. A free server is a rehearsal room for failures, and this account has argued that position before; the missing piece is a token ledger that turns the grant into a measurable experiment.
Why a meter beats a dashboard
Dashboards report spend after the fact, while a meter with a pre-commit budget changes behavior before the call. The unit that matters is signal per token, not tokens per month, and that ratio is almost never computed. A ledger forces you to declare a budget, record a verdict, and review the pattern weekly.
The ledger below classifies every call into four task kinds that match real review gates. kill_test tasks ask the model to delete or weaken tests, patch tasks produce code changes, migration tasks rewrite schema or dependencies, and replay tasks run traffic against a patched server. Each kind gets its own budget, because a migration is not the same risk as a one-line fix.
The artifact: meter.py
#!/usr/bin/env python3
"""meter.py — a token ledger for free-model experiments.
Usage:
meter.py log --model <model> --kind kill_test --budget 4000 --task "..."
meter.py report
"""
import argparse
import os
import sqlite3
import time
from openai import OpenAI
DB = os.path.join(os.path.dirname(__file__), "token_ledger.db")
def connect():
con = sqlite3.connect(DB)
con.execute(
"""CREATE TABLE IF NOT EXISTS ledger (
id INTEGER PRIMARY KEY,
ts TEXT NOT NULL,
kind TEXT NOT NULL,
task TEXT NOT NULL,
prompt_tokens INTEGER NOT NULL,
completion_tokens INTEGER NOT NULL,
verdict TEXT NOT NULL)"""
)
return con
def cmd_log(args):
client = OpenAI(base_url=args.base_url, api_key=args.api_key)
response = client.chat.completions.create(
model=args.model,
messages=[{"role": "user", "content": args.task}],
)
usage = response.usage
total = usage.prompt_tokens + usage.completion_tokens
verdict = "ok" if total <= args.budget else "over_budget"
con = connect()
con.execute(
"INSERT INTO ledger (ts, kind, task, prompt_tokens, completion_tokens, verdict) "
"VALUES (?, ?, ?, ?, ?, ?)",
(time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
args.kind, args.task[:200], usage.prompt_tokens,
usage.completion_tokens, verdict),
)
con.commit()
print(f"{verdict}: {total}/{args.budget} tokens for {args.kind}")
con.close()
def cmd_report(args):
con = connect()
rows = con.execute(
"SELECT kind, COUNT(*), SUM(prompt_tokens + completion_tokens), "
"SUM(verdict = 'over_budget') FROM ledger GROUP BY kind"
).fetchall()
print(f"{'kind':<12}{'calls':>6}{'tokens':>12}{'over':>6}")
for kind, calls, tokens, over in rows:
print(f"{kind:<12}{calls:>6}{tokens:>12}{over:>6}")
con.close()
def main():
parser = argparse.ArgumentParser(prog="meter.py")
sub = parser.add_subparsers(dest="command", required=True)
p_log = sub.add_parser("log", help="meter one model call")
p_log.add_argument("--base-url", default=os.environ.get("OPENAI_BASE_URL"))
p_log.add_argument("--api-key", default=os.environ.get("OPENAI_API_KEY"))
p_log.add_argument("--model", required=True)
p_log.add_argument("--kind", required=True,
choices=["kill_test", "patch", "migration", "replay"])
p_log.add_argument("--budget", type=int, default=4000)
p_log.add_argument("--task", required=True)
p_log.set_defaults(func=cmd_log)
p_rep = sub.add_parser("report", help="summarize the ledger")
p_rep.set_defaults(func=cmd_report)
args = parser.parse_args()
args.func(args)
if __name__ == "__main__":
main()
The script uses the standard OpenAI-compatible client, so it works with any endpoint that reports a usage field. It records provider-reported token counts, which are estimates rather than ground truth, and it stores every call in a local SQLite ledger. The report command groups spend by task kind and counts how many calls exceeded their budget.
Five steps to spend a grant like an engineer
-
Set budgets per task kind. Start with 4,000 tokens for
kill_test, 8,000 forpatch, 16,000 formigration, and 6,000 forreplay; adjust after the first report. - Wrap every call in the meter. Never invoke the model directly, because unwrapped calls are invisible spend and invisible spend is ungovernable.
- Run the experiment on the free server. Use MonkeyCode's free server option to rehearse the patch against replay traffic before any human reads the diff.
-
Check the verdict column before the diff. An
over_budgetverdict means the task was underspecified, and the output should be discarded regardless of quality. -
Review the report weekly. Kill any task kind that never produces an
okverdict, and move its budget to a kind that does.
Where MonkeyCode fits
MonkeyCode is an open-source project that provides free model access and a free server option, and the current offering includes a 10M token grant for experiments. Treat that grant as a measurement budget, not a writing budget, because the meter only works when the budget is scarce enough to matter. The open-source codebase also lets you inspect what the server actually does, which is the difference between telemetry you trust and telemetry you inherit.
The project's value is that you can audit the loop end to end, from the prompt to the patch to the verdict. Closed tools force you to trust their dashboards, while an open ledger plus an open server makes the whole pipeline inspectable. That auditability is what turns a free grant from a marketing hook into a real engineering resource.
Limitations and who should not use this
The meter only measures spend, so it is useless if you have no test suite or replay harness to judge the output. Teams without a review gate should build that gate first, because a ledger of garbage verdicts is still garbage. The script also trusts the provider's usage field, which can differ from actual compute by a meaningful margin.
Do not use this workflow for UI prototyping, copywriting, or one-off questions, where the ledger overhead exceeds the value of the answer. Do not use it if you are unwilling to discard over_budget outputs, because the verdict only works when you respect it. The approach is for engineers who treat free compute as a finite experimental resource, not as a substitute for judgment.
The bottom line
A 10M token grant is a rare chance to measure your own review pipeline, and the meter is the cheapest instrument you can add. Clone the open-source project, point the script at the free endpoint, and run the report after one week of real tasks. The numbers will tell you which experiments deserve the next grant, and that is the only opinion that matters.
Top comments (0)