From 9ce2013814074f0a0b2e2d4aacb6a727c0788e85 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 18 Mar 2026 20:33:31 -0400 Subject: [PATCH] Short God messages, escpos cost printing, Anthropic provider fixes Co-Authored-By: Claude Opus 4.6 (1M context) --- mc_aigod_paper.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mc_aigod_paper.py b/mc_aigod_paper.py index ae0cde1..ba82621 100644 --- a/mc_aigod_paper.py +++ b/mc_aigod_paper.py @@ -2070,9 +2070,27 @@ def _anthropic_call(model: str, system: str, user: str, config: dict, # Track cost (Haiku pricing) cost = (input_tokens / 1_000_000) * 0.80 + (output_tokens / 1_000_000) * 4.00 with _anthropic_cost_lock: + prev_dollar = int(_anthropic_total_cost) _anthropic_total_cost += cost - if int(_anthropic_total_cost * 100) % 50 == 0 or _anthropic_total_cost >= budget * 0.9: - log.info(f"Anthropic cost: ${_anthropic_total_cost:.4f} / ${budget:.2f}") + curr_dollar = int(_anthropic_total_cost) + if curr_dollar > prev_dollar: + log.info(f"Anthropic cost milestone: ${_anthropic_total_cost:.4f} / ${budget:.2f}") + # Print to POS printer + try: + import socket as _sock + from escpos.printer import Dummy as _Dummy + _p = _Dummy(profile="default") + _p.set(font='b', align='center', bold=True) + _p.text("MC AI TRAINING COST\n") + _p.set(font='b', align='center', bold=False) + _p.text(f"${_anthropic_total_cost:.4f} / ${budget:.2f}\n") + _p.text(f"{time.strftime('%Y-%m-%d %H:%M')}\n") + _p.text("=" * 57 + "\n") + _p.cut() + with _sock.create_connection(("192.168.0.137", 9100), timeout=5) as _s: + _s.sendall(_p.output) + except Exception as _pe: + log.warning(f"POS print failed: {_pe}") return text