Reserved capacity under-utilized
Provisioned throughput (Azure OpenAI PTUs, dedicated deployments with other providers) is capacity bought up front for a fixed monthly price. It saves at peak, but if real load is below what you committed, you pay for air. Unlike pay-as-you-go, nobody here sends “your bill went up” — the money is charged the same every month, and under-utilization isn’t visible anywhere except the dashboard you don’t visit.
The solution is a daily “committed vs used” reconciliation with a push on sustained under-load.
Daily committed vs used check
Section titled “Daily committed vs used check”We compute the average utilization over the day and alert if it stays below the threshold for several days in a row — which means part of the PTUs can be cut.
import os, json, time, requests
NOTIFLY_URL = os.environ["NOTIFLY_URL"]NOTIFLY_TOKEN = os.environ["NOTIFLY_TOKEN"]
COMMITTED_PTU = 100 # how many units are boughtCOST_PER_PTU = 260.0 # $/mo per unit (example)MIN_UTIL = 0.60 # below 60% average utilization = under-utilizationDAYS_TO_CONFIRM = 3 # this many days in a row confirm the conclusion
STATE = os.path.expanduser("~/.reserved-capacity.json")
def notify(title, msg, prio): requests.post(f"{NOTIFLY_URL}/message", params={"token": NOTIFLY_TOKEN}, json={"title": title, "message": msg, "priority": prio}, timeout=5)
def load_state(): if os.path.exists(STATE): return json.load(open(STATE)) return {"low_days": 0, "last_day": ""}
def daily_check(used_ptu_avg): """used_ptu_avg — the average actual utilization over the day (from provider metrics).""" day = time.strftime("%Y-%m-%d") st = load_state() if st["last_day"] == day: # already counted today — no duplicates return util = used_ptu_avg / COMMITTED_PTU
if util < MIN_UTIL: st["low_days"] += 1 else: st["low_days"] = 0 st["last_day"] = day json.dump(st, open(STATE, "w"))
if st["low_days"] >= DAYS_TO_CONFIRM: wasted = (COMMITTED_PTU - used_ptu_avg) * COST_PER_PTU notify( f"📉 Reserved-мощность простаивает: {util:.0%}", f"{DAYS_TO_CONFIRM} дня подряд утилизация < {MIN_UTIL:.0%}. " f"Впустую ≈${wasted:,.0f}/мес — сократите committed PTU.", priority=6, )
# usage: plug in the average utilization from Azure Monitor / provider metricsdaily_check(used_ptu_avg=48)A threshold over several days in a row (DAYS_TO_CONFIRM) cuts off one-off
quiet weekends — we react only to a sustained trend. priority=6: this is
about money, not an incident, no need to wake you up at night.
Where to get used_ptu_avg
Section titled “Where to get used_ptu_avg”Actual utilization is exposed by provider metrics — for example, Azure Monitor’s
Provisioned-managed Utilization metric. Pull it with a REST request in the
same script or export it into your TSDB and read it from there. It’s convenient
to hang the script itself on a timer-trigger in Yandex Cloud once a day — the
skeleton is in the recipe
Custom cloud function for integrity checks.
The mirror case — reserved overload
Section titled “The mirror case — reserved overload”The reverse problem: utilization hits 100% and requests start spilling over to
expensive pay-as-you-go. Add a second branch with util >= 0.95 and
priority=8 — that’s already about money AND user latency.
What to put in the alert text
Section titled “What to put in the alert text”- committed vs average actual utilization (in units and in %);
- how many days in a row the under-load has held;
- an estimate of money wasted per month;
- a link to the quota management page, to cut the committed amount.