#!/usr/bin/env python3 """Fail if a EUR-quoted provider's model_info is not EUR * FX. GreenPT and Regolo quote EUR; LiteLLM costs are USD. Pasting EUR numerals into model_info under-bills members by the FX gap (found 2026-11-18). """ import re import sys FX = 1.16 EUR = { "greenpt/deepseek-v4.1-flash": (0.36, 1.45, 0.04), "greenpt/glm-5.3-flash": (0.11, 0.44, 0.022), "greenpt/glm-5.3": (1.10, 4.40, 0.275), "greenpt/green-embeddings": (0.20, 0.0, None), "greenpt/qwen3-embedding-8b": (0.25, 0.0, None), "regolo/mistral-small-4-119b": (0.20, 0.70, None), "regolo/gemma4-31b": (0.40, 0.60, None), # Route aliases carry their own model_info; members call these names, so a # deployment-only conversion leaves billing stale (found 2026-11-18). "deepseek-flash-green": (0.36, 1.45, 0.04), "glm-flash-green": (0.11, 0.44, 0.022), } text = open("config.yaml", encoding="utf-8").read() bad = [] for name, (i, o, c) in EUR.items(): m = re.search(r"- model_name: " + re.escape(name) + r"\n(.*?)(?=\n - model_name: |\n[a-zA-Z#])", text, re.S) if not m: bad.append(f"{name}: missing block") continue block = m.group(1) def val(key): mm = re.search(key + r": (\S+)", block) return float(mm.group(1)) if mm else None checks = [("input_cost_per_token", i), ("output_cost_per_token", o)] if c is not None: checks.append(("cache_read_input_token_cost", c)) for key, eur in checks: want = eur * FX / 1_000_000 got = val(key) if got is None or abs(got - want) > max(1e-12, want * 1e-6): bad.append(f"{name}: {key} got {got}, want {want:.10g}") print("checked", len(EUR), "EUR models at FX", FX) if bad: print("\n".join(bad)) sys.exit(1) print("OK: EUR list prices converted to USD")