Dev.to WebDev 🛠 Dev 👁 2 📖 5 min read

A 60-line script that tells you when a model you use is pulled

On 30 November, claude-4.5-sonnet was removed from the catalogue. If that ID was hard-coded in your app, the first sign would have been a failed request. The catalogue publishes what changed. It does not push. A public

On 30 November, claude-4.5-sonnet was removed from the catalogue. If that ID was hard-coded in your app, the first sign would have been a failed request.

The catalogue publishes what changed. It does not push. A public change log is only useful if something reads it, so here is the smallest thing that does.

What the log actually contains

AICraft syncs its catalogue twice a day, at 07:57 and 19:23 China Standard Time, and writes every difference to a public file:

https://aicraftapi.net/api/changelog.json

The current file was generated at 2026-11-29T23:57:14+00:00. It declares a rolling 90-day window; the oldest event in it is dated 10 October. It reports 141 models on sale.

Inside that window there are 421 events: 93 removals, 47 additions, 199 price events, 61 first-time prices and 21 media changes. One day carries most of the damage. On 16 November, 52 model IDs went off sale in a single batch.

Every event has the same four fields: date, type, model, detail. That is enough to check a watchlist and nothing more, which is the point.

The script

Save this as model_watch.py. It reads a text file of model IDs, fetches the log, and prints anything that touched those IDs.

#!/usr/bin/env python3
"""Fail loudly when a model you depend on is removed or repriced.

Usage: python3 model_watch.py [watchlist.txt]
Exit code 1 means at least one alert; 0 means nothing changed for your IDs.
"""

from __future__ import annotations

import json
import os
import re
import sys
import urllib.request
from pathlib import Path

CHANGELOG_URL = "https://aicraftapi.net/api/changelog.json"
PRICE_ALERT_PCT = float(os.environ.get("PRICE_ALERT_PCT", "10"))
PRICE_RE = re.compile(r"(in|out)\s*\$([0-9.]+)\s*→\s*\$([0-9.]+)")


def load_watchlist(path: Path) -> set[str]:
    lines = path.read_text(encoding="utf-8").splitlines()
    return {ln.strip() for ln in lines if ln.strip() and not ln.lstrip().startswith("#")}


def fetch_changelog(url: str) -> dict:
    with urllib.request.urlopen(url, timeout=30) as resp:
        return json.load(resp)


def price_moves(detail: str) -> list[tuple[str, str, str, float]]:
    moves = []
    for side, before, after in PRICE_RE.findall(detail):
        old, new = float(before), float(after)
        if old:
            moves.append((side, before, after, (new - old) / old * 100))
    return moves


def main() -> int:
    path = Path(sys.argv[1] if len(sys.argv) > 1 else "watchlist.txt")
    watch = load_watchlist(path)
    data = fetch_changelog(CHANGELOG_URL)
    alerts: list[str] = []
    seen: set[tuple] = set()

    print(f"catalogue {data['generated_at']} | {data['models_on_sale']} models on sale")
    for event in data["events"]:
        model = event.get("model", "")
        if model not in watch:
            continue
        if event["type"] == "removed":
            alerts.append(f"REMOVED  {event['date']}  {model}")
        elif event["type"] == "price":
            for side, old, new, pct in price_moves(event.get("detail", "")):
                if abs(pct) < PRICE_ALERT_PCT:
                    continue
                key = (model, side, old, new)
                if key in seen:  # the log repeats confirmations
                    continue
                seen.add(key)
                alerts.append(f"PRICE {pct:+.1f}% {side:<3}  {event['date']}  {model}  ${old} -> ${new}")

    if not alerts:
        print("no removals or price moves above threshold for your IDs")
        return 0
    print(f"{len(alerts)} alert(s):")
    for line in alerts:
        print("  " + line)
    return 1


if __name__ == "__main__":
    sys.exit(main())

The watchlist is four IDs, one per line:

claude-4.5-sonnet
bytedance/doubao-seed-2-1-pro
moonshotai/kimi-k3.1-pro
qwen/qwen3.8-flash-next

What a real run prints

catalogue 2026-11-29T23:57:14+00:00 | 141 models on sale
4 alert(s):
  PRICE +16.9% in   2026-10-10  bytedance/doubao-seed-2-1-pro  $0.8219 -> $0.9609
  PRICE +10.5% in   2026-10-10  claude-4.5-sonnet  $3.0000 -> $3.3150
  PRICE +10.5% out  2026-10-10  claude-4.5-sonnet  $15.0000 -> $16.5750
  REMOVED  2026-11-30  claude-4.5-sonnet

Two details in that output are worth copying.

The log writes the same price move more than once. bytedance/doubao-seed-2-1-pro appears on three separate dates with identical numbers. The script keeps a set of (model, side, old, new) tuples so you get one alert per real move instead of three. Across the whole file, 63 models repeat a price event this way, so the deduplication is not a corner case.

The exit code is the interface. 1 means something changed, 0 means silence. That makes it usable in cron, CI, and anything that treats a non-zero exit as a failure.

Run it against a model with no events and it prints one line and exits 0:

catalogue 2026-11-29T23:57:14+00:00 | 141 models on sale
no removals or price moves above threshold for your IDs

Put it on a timer

One cron entry is enough. The log refreshes at 07:57 and 19:23 CST, so run the check after each sync (the times below assume the server clock is on CST):

35 8,20 * * * cd /srv/model-watch && python3 model_watch.py watchlist.txt >> watch.log 2>&1

If you would rather block a deploy than find out in production, call it from CI with a small wrapper that turns exit code 1 into a failed job. The script is under 60 lines and has no dependencies outside the standard library.

What it does not do

It only sees events from the last 90 days. A model removed in July is not in today's file, so an empty result is not proof that an ID still works.

It reads the catalogue, not your key. A model can be listed and still fail for your account, region, or input size. The log will not tell you that.

It has no push channel. There is no webhook and no email from this file. You run it, or nothing runs it.

And removals can reverse. An ID that disappears can come back, which is why the script reports dates instead of maintaining a state machine.

Why the file is public

I work on AICraft, and the change log is the part of the product I would want as a customer. Three things make it checkable rather than a claim.

Every price event carries the before and after values. The script above parses them, and so can you, with one curl and no key.

The noisy re-confirmations are published rather than filtered. That is why the window shows 199 price events, and 67 of them contain a real difference. Filtering would make the file look cleaner and less honest.

One key covers the catalogue the file describes (141 models in this run), so moving off a pulled ID is a string change rather than a new integration. That is the part the file cannot prove for you; the catalogue page can.

The same file is the source for this article and for the catalogue page. If a number here looks wrong, fetch the file and compare. We also list the limit in the open: 90 days, no push, catalogue-level only. A change log cannot cover what it does not observe.

The script is the whole integration. Copy it, change the IDs, keep the exit code.

If you want the raw file: curl https://aicraftapi.net/api/changelog.json. If you want the catalogue behind it: aicraftapi.net/models.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.