pricing: regenerate USD fallback at ECB 1.0975, fix stale header, harden gate

The config header still claimed "EUR->USD FX = 1.16" and listed GreenPT/Regolo
EUR numerals with $ signs; the committed USD fallback was likewise generated
at 1.16 while the gateway has been applying the ECB daily rate since the boot
sync landed (live 1.0975 on 2026-11-26). Live billing was correct, but anyone
reading the config — members included — saw pre-conversion rates presented as
USD, and a first-install fallback over-billed by ~5.7%.

- Header now names eur_prices.json as the only source, says the USD numerals
  are generated, and pins the fallback at 1.0975 (ECB 2026-11-26).
- All GreenPT/Regolo model_info regenerated at that pin; in-file price comments
  relabelled EUR where they carried EUR numerals.
- check_eur_fx.py now reads eur_prices.json instead of a hardcoded list (which
  silently omitted regolo/apertus-70b and regolo/qwen3.5-122b), takes FX from
  FX_FALLBACK_USD, and fails if the config header pin disagrees.
This commit is contained in:
inference-bot committed 2026-11-27 17:57:54 +00:00
1 parent 4610e688db
commit 18aa7c7573
2 files changed
+95 -73

No files matched your search

+49 -47
View File
@@ -5,28 +5,30 @@
# with EHBP (HPKE) before forwarding to the Tinfoil enclave. Provider key set # with EHBP (HPKE) before forwarding to the Tinfoil enclave. Provider key set
# via environment variable TINFOIL_API_KEY. # via environment variable TINFOIL_API_KEY.
# #
# Pricing (model_info) is per-token, derived from provider per-1M rates: # Pricing (model_info) is per-token, USD.
# EUR->USD FX = 1.16 (policy, set 2026-11-18). GreenPT and Regolo quote EUR; # Tinfoil quotes USD list prices: the fixed figures below are provider rates.
# LiteLLM's cost fields are USD-shaped, so EUR list prices are converted here. # GreenPT and Regolo quote EUR: their EUR list prices live in eur_prices.json —
# the ONLY source of those numbers. At boot, fx_sync.py fetches the ECB daily
# reference rate, converts each EUR entry (EUR x rate / 1e6) and rewrites the
# matching model_info fields in /app/data/config.yaml. Fail-open: if the feed is
# unreachable the config is left untouched and the boot continues.
# Never paste EUR numerals into model_info — that under-bills members by the FX gap. # Never paste EUR numerals into model_info — that under-bills members by the FX gap.
# greenpt/deepseek-v4.1-flash: $0.36 in / $1.45 out / $0.04 cached per 1M (1017 snapshot) # GreenPT/Regolo USD numerals are GENERATED, not maintained here: do not read
# them as list prices and do not edit them by hand. Their fallback pin is
# FX_FALLBACK_USD (1.0975 = ECB 2026-11-26), served only when no synced copy exists.
#
# tinfoil/deepseek-v4-1-flash: $0.65 in / $1.45 out / $0.13 cached per 1M # tinfoil/deepseek-v4-1-flash: $0.65 in / $1.45 out / $0.13 cached per 1M
# tinfoil/gpt-oss-120b: $0.15 in / $0.60 out per 1M # tinfoil/gpt-oss-120b: $0.15 in / $0.60 out per 1M
# tinfoil/glm-5.3: $1.80 in / $5.75 out / $0.45 cached per 1M # tinfoil/glm-5.3: $1.80 in / $5.75 out / $0.45 cached per 1M
# greenpt/qwen3-embedding-8b: $0.25 in / $0 out per 1M (embeddings, 32K ctx)
# greenpt/green-embeddings: $0.20 in / $0 out per 1M (embeddings, 32K ctx)
# tinfoil/nomic-embed-text: $0.016 in / $0 out per 1M (embeddings, 8K ctx, TEE) # tinfoil/nomic-embed-text: $0.016 in / $0 out per 1M (embeddings, 8K ctx, TEE)
# regolo/mistral-small-4-119b: $0.20 in / $0.70 out per 1M (60K ctx)
# regolo/gemma4-31b: $0.40 in / $0.60 out per 1M (100K ctx)
# tinfoil/voxtral-small-24b: $0.20 in / $0.60 out per 1M (token-priced audio; # tinfoil/voxtral-small-24b: $0.20 in / $0.60 out per 1M (token-priced audio;
# +$0.00008/request on /v1/audio/transcriptions) # +$0.00008/request on /v1/audio/transcriptions)
# Without these, LiteLLM can't price these custom models, so spend shows $0.00 # Without these entries LiteLLM can't price these custom models, so spend shows
# and the team budget cap is not enforced. # $0.00 and the team budget cap is not enforced.
# #
# SYNC: the per-model pricing here must mirror the user-facing model list in # SYNC: the user-facing list in co-op/docs/models.md carries the EUR list prices
# co-op/docs/models.md (and vice-versa). When a rate changes, update BOTH this # and says USD billing follows the ECB daily rate. When a provider changes a
# file and models.md — this config is the authoritative source of the numbers; # list price, update eur_prices.json first, then models.md.
# models.md is the member-facing mirror.
model_list: model_list:
# DeepSeek V4.1 Flash on GreenPT — DEFAULT model. SERVES THE 1017 SNAPSHOT # DeepSeek V4.1 Flash on GreenPT — DEFAULT model. SERVES THE 1017 SNAPSHOT
@@ -38,16 +40,16 @@ model_list:
# deepseek-v4-1-flash, but on renewable energy and NOT marked Experimental by the # deepseek-v4-1-flash, but on renewable energy and NOT marked Experimental by the
# provider (Tinfoil's deepseek + glm-flash carry an "Experimental: may be deprecated # provider (Tinfoil's deepseek + glm-flash carry an "Experimental: may be deprecated
# with minimal notice" flag). Policy-based privacy (GreenPT) vs TEE (Tinfoil). # with minimal notice" flag). Policy-based privacy (GreenPT) vs TEE (Tinfoil).
# $0.36 in / $1.45 out / $0.04 cached per 1M (1017 snapshot; repointed 2026-11-16). # EUR list: 0.36 in / 1.45 out / 0.04 cached per 1M (1017 snapshot; repointed 2026-11-16).
- model_name: greenpt/deepseek-v4.1-flash - model_name: greenpt/deepseek-v4.1-flash
litellm_params: litellm_params:
model: openai/deepseek-v4.1-flash-1017 model: openai/deepseek-v4.1-flash-1017
api_base: https://api.greenpt.ai/v1 api_base: https://api.greenpt.ai/v1
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
input_cost_per_token: 4.176e-07 input_cost_per_token: 3.951e-07
output_cost_per_token: 1.682e-06 output_cost_per_token: 1.591375e-06
cache_read_input_token_cost: 4.64e-08 cache_read_input_token_cost: 4.39e-08
# DeepSeek V4.1 Flash on Tinfoil (TEE) — private counterpart to the default. # DeepSeek V4.1 Flash on Tinfoil (TEE) — private counterpart to the default.
- model_name: tinfoil/deepseek-v4-1-flash - model_name: tinfoil/deepseek-v4-1-flash
@@ -89,28 +91,28 @@ model_list:
# (Removed 2026-10: green-l/green-r — GreenPT now marks them "not recommended".) # (Removed 2026-10: green-l/green-r — GreenPT now marks them "not recommended".)
# GLM-5.3 Flash on GreenPT (note the dotted slug — distinct from Tinfoil's # GLM-5.3 Flash on GreenPT (note the dotted slug — distinct from Tinfoil's
# glm-5-3-flash). $0.11 in / $0.44 out / $0.022 cached per 1M. # glm-5-3-flash). EUR list: 0.11 in / 0.44 out / 0.022 cached per 1M.
- model_name: greenpt/glm-5.3-flash - model_name: greenpt/glm-5.3-flash
litellm_params: litellm_params:
model: openai/glm-5.3-flash model: openai/glm-5.3-flash
api_base: https://api.greenpt.ai/v1 api_base: https://api.greenpt.ai/v1
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
input_cost_per_token: 1.276e-07 input_cost_per_token: 1.20725e-07
output_cost_per_token: 5.104e-07 output_cost_per_token: 4.829e-07
cache_read_input_token_cost: 2.552e-08 cache_read_input_token_cost: 2.4145e-08
# GLM-5.3 (full flagship) on GreenPT — strongest agentic model in the green # GLM-5.3 (full flagship) on GreenPT — strongest agentic model in the green
# tier. $1.10 in / $4.40 out per 1M, 1M context. # tier. EUR list: 1.10 in / 4.40 out per 1M, 1M context.
- model_name: greenpt/glm-5.3 - model_name: greenpt/glm-5.3
litellm_params: litellm_params:
model: openai/glm-5.3 model: openai/glm-5.3
api_base: https://api.greenpt.ai/v1 api_base: https://api.greenpt.ai/v1
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
input_cost_per_token: 1.276e-06 input_cost_per_token: 1.20725e-06
output_cost_per_token: 5.104e-06 output_cost_per_token: 4.829e-06
cache_read_input_token_cost: 3.19e-07 cache_read_input_token_cost: 3.018125e-07
# --- Audio models (Tinfoil, inside the TEE) --- # --- Audio models (Tinfoil, inside the TEE) ---
# NOT chat models: these power /v1/audio/* routes (STT for dictation, TTS for # NOT chat models: these power /v1/audio/* routes (STT for dictation, TTS for
@@ -132,7 +134,7 @@ model_list:
# phase consumes the entire token budget and content comes back empty. # phase consumes the entire token budget and content comes back empty.
# mistral-small-4-119b + gemma4-31b: added 2026-11-13 (operator-approved). # mistral-small-4-119b + gemma4-31b: added 2026-11-13 (operator-approved).
# Rates read live from Regolo's own model catalog (regolo.ai/models): # Rates read live from Regolo's own model catalog (regolo.ai/models):
# mistral $0.20/$0.70 per 1M, 60K in / 60K out; gemma4 $0.40/$0.60, # mistral EUR 0.20/0.70 per 1M, 60K in / 60K out; gemma4 EUR 0.40/0.60,
# 100K in / 100K out. # 100K in / 100K out.
# Qwen-Image: image generation via /v1/images/generations, billed per pixel. # Qwen-Image: image generation via /v1/images/generations, billed per pixel.
- model_name: regolo/apertus-70b - model_name: regolo/apertus-70b
@@ -142,8 +144,8 @@ model_list:
api_key: os.environ/REGOLO_API_KEY api_key: os.environ/REGOLO_API_KEY
model_info: model_info:
mode: chat mode: chat
input_cost_per_token: 1.16e-6 input_cost_per_token: 1.0975e-06
output_cost_per_token: 3.944e-6 output_cost_per_token: 3.7315e-06
- model_name: regolo/qwen3.5-122b - model_name: regolo/qwen3.5-122b
litellm_params: litellm_params:
@@ -153,11 +155,11 @@ model_list:
chat_template_kwargs: {"enable_thinking": false} chat_template_kwargs: {"enable_thinking": false}
model_info: model_info:
mode: chat mode: chat
input_cost_per_token: 6.96e-7 input_cost_per_token: 6.585e-07
output_cost_per_token: 3.944e-6 output_cost_per_token: 3.7315e-06
# Mistral Small 4 (119B) — hybrid instruct + reasoning model (three model # Mistral Small 4 (119B) — hybrid instruct + reasoning model (three model
# families unified by Regolo). $0.20 in / $0.70 out per 1M, 60K ctx. # families unified by Regolo). EUR list: 0.20 in / 0.70 out per 1M, 60K ctx.
- model_name: regolo/mistral-small-4-119b - model_name: regolo/mistral-small-4-119b
litellm_params: litellm_params:
model: openai/mistral-small-4-119b model: openai/mistral-small-4-119b
@@ -165,10 +167,10 @@ model_list:
api_key: os.environ/REGOLO_API_KEY api_key: os.environ/REGOLO_API_KEY
model_info: model_info:
mode: chat mode: chat
input_cost_per_token: 2.32e-07 input_cost_per_token: 2.195e-07
output_cost_per_token: 8.12e-07 output_cost_per_token: 7.6825e-07
# Gemma 4 (31B) — Google's dense multimodal Gemma 4. $0.40 in / $0.60 out # Gemma 4 (31B) — Google's dense multimodal Gemma 4. EUR list: 0.40 in / 0.60 out
# per 1M, 100K ctx. # per 1M, 100K ctx.
- model_name: regolo/gemma4-31b - model_name: regolo/gemma4-31b
litellm_params: litellm_params:
@@ -177,8 +179,8 @@ model_list:
api_key: os.environ/REGOLO_API_KEY api_key: os.environ/REGOLO_API_KEY
model_info: model_info:
mode: chat mode: chat
input_cost_per_token: 4.64e-07 input_cost_per_token: 4.39e-07
output_cost_per_token: 6.96e-07 output_cost_per_token: 6.585e-07
- model_name: regolo/qwen-image - model_name: regolo/qwen-image
litellm_params: litellm_params:
@@ -297,7 +299,7 @@ model_list:
# embedding was opened to members the same day). The portal filters # embedding was opened to members the same day). The portal filters
# mode:embedding out of the chat picker, so it is API-only — same shape as # mode:embedding out of the chat picker, so it is API-only — same shape as
# the audio models above. # the audio models above.
# Pricing per GreenPT /v1/pricing: $0.25/1M input, no output charge # Pricing per GreenPT /v1/pricing: EUR 0.25/1M input, no output charge
# (embeddings return vectors; GreenPT lists maxOutputTokens null), 32K # (embeddings return vectors; GreenPT lists maxOutputTokens null), 32K
# context. max_input_tokens declared from the provider's contextWindowTokens # context. max_input_tokens declared from the provider's contextWindowTokens
# so clients don't invent a larger one (the null-caps defect). # so clients don't invent a larger one (the null-caps defect).
@@ -308,7 +310,7 @@ model_list:
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
mode: embedding mode: embedding
input_cost_per_token: 2.9e-07 input_cost_per_token: 2.74375e-07
output_cost_per_token: 0 output_cost_per_token: 0
max_input_tokens: 32000 max_input_tokens: 32000
@@ -321,7 +323,7 @@ model_list:
# Cheaper per token than qwen3-embedding-8b; the reranker sibling # Cheaper per token than qwen3-embedding-8b; the reranker sibling
# (green-rerank) is a different capability and is NOT served. # (green-rerank) is a different capability and is NOT served.
# Same shape: /v1/embeddings only, filtered out of the chat picker. # Same shape: /v1/embeddings only, filtered out of the chat picker.
# Pricing per GreenPT /v1/pricing: $0.20/1M input, no output charge, 32K ctx. # Pricing per GreenPT /v1/pricing: EUR 0.20/1M input, no output charge, 32K ctx.
- model_name: greenpt/green-embeddings - model_name: greenpt/green-embeddings
litellm_params: litellm_params:
model: openai/green-embeddings model: openai/green-embeddings
@@ -329,7 +331,7 @@ model_list:
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
mode: embedding mode: embedding
input_cost_per_token: 2.32e-07 input_cost_per_token: 2.195e-07
output_cost_per_token: 0 output_cost_per_token: 0
max_input_tokens: 32000 max_input_tokens: 32000
@@ -359,9 +361,9 @@ model_list:
api_base: https://api.greenpt.ai/v1 api_base: https://api.greenpt.ai/v1
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
input_cost_per_token: 4.176e-07 input_cost_per_token: 3.951e-07
output_cost_per_token: 1.682e-06 output_cost_per_token: 1.591375e-06
cache_read_input_token_cost: 4.64e-08 cache_read_input_token_cost: 4.39e-08
- model_name: deepseek-flash-tee - model_name: deepseek-flash-tee
litellm_params: litellm_params:
@@ -379,9 +381,9 @@ model_list:
api_base: https://api.greenpt.ai/v1 api_base: https://api.greenpt.ai/v1
api_key: os.environ/GREENPT_API_KEY api_key: os.environ/GREENPT_API_KEY
model_info: model_info:
input_cost_per_token: 1.276e-07 input_cost_per_token: 1.20725e-07
output_cost_per_token: 5.104e-07 output_cost_per_token: 4.829e-07
cache_read_input_token_cost: 2.552e-08 cache_read_input_token_cost: 2.4145e-08
# Tinfoil's flash GLM was deprecated 2026-10-09; the TEE route for this family # Tinfoil's flash GLM was deprecated 2026-10-09; the TEE route for this family
# is the flagship, so the alias is named glm-tee rather than glm-flash-tee. # is the flagship, so the alias is named glm-tee rather than glm-flash-tee.
+46 -26
View File
@@ -3,46 +3,66 @@
GreenPT and Regolo quote EUR; LiteLLM costs are USD. Pasting EUR numerals into 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). model_info under-bills members by the FX gap (found 2026-11-18).
The EUR list prices live in eur_prices.json (the only source). This gate reads
that file instead of duplicating the prices, so a model added or repriced there
is covered automatically — the old hardcoded list missed regolo/apertus-70b and
regolo/qwen3.5-122b entirely.
FX is the FALLBACK pin: the rate the committed USD numerals were generated at.
At boot fx_sync.py overwrites them with the ECB daily rate, so this gate only
checks the committed (first-install) fallback. Keep FX_FALLBACK_USD equal to the
pin named in config.yaml's header.
""" """
import json
import os
import re import re
import sys import sys
FX = 1.16 FX = float(os.environ.get("FX_FALLBACK_USD", "1.0975"))
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),
}
eur = json.load(open("eur_prices.json", encoding="utf-8"))["models"]
text = open("config.yaml", encoding="utf-8").read() text = open("config.yaml", encoding="utf-8").read()
# The header states the pin; a mismatch means the fallback was regenerated at a
# different rate than the gate expects, which is how a stale 1.16 survived.
hdr = re.search(r"FX_FALLBACK_USD \(([0-9.]+)", text)
if hdr and abs(float(hdr.group(1)) - FX) > 1e-9:
print(f"FAIL: config header pins FX {hdr.group(1)}, gate expects {FX}")
sys.exit(1)
def block_for(name: str):
m = re.search(r"- model_name: " + re.escape(name) +
r"\n(.*?)(?=\n - model_name: |\n[a-zA-Z#])", text, re.S)
return m.group(1) if m else None
bad = [] bad = []
for name, (i, o, c) in EUR.items(): for name, prices in eur.items():
m = re.search(r"- model_name: " + re.escape(name) + r"\n(.*?)(?=\n - model_name: |\n[a-zA-Z#])", text, re.S) block = block_for(name)
if not m: if block is None:
bad.append(f"{name}: missing block") bad.append(f"{name}: missing block")
continue continue
block = m.group(1)
def val(key): def val(key, block=block):
mm = re.search(key + r": (\S+)", block) mm = re.search(key + r": (\S+)", block)
return float(mm.group(1)) if mm else None 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 = [("input_cost_per_token", prices.get("input")),
checks.append(("cache_read_input_token_cost", c)) ("output_cost_per_token", prices.get("output"))]
for key, eur in checks: if prices.get("cache") is not None:
want = eur * FX / 1_000_000 checks.append(("cache_read_input_token_cost", prices["cache"]))
for key, eur_val in checks:
if eur_val is None:
continue
want = eur_val * FX / 1_000_000
got = val(key) got = val(key)
if got is None or abs(got - want) > max(1e-12, want * 1e-6): if got is None or abs(got - want) > max(1e-12, want * 1e-6):
bad.append(f"{name}: {key} got {got}, want {want:.10g}") bad.append(f"{name}: {key} got {got}, want {want:.10g}")
print("checked", len(EUR), "EUR models at FX", FX)
print(f"checked {len(eur)} EUR models at fallback FX {FX}")
if bad: if bad:
print("\n".join(bad)) print("\n".join(bad))
sys.exit(1) sys.exit(1)
print("OK: EUR list prices converted to USD") print("OK: EUR list prices converted to USD at the fallback pin")