# Model Release & Pricing Registry Service

## PURPOSE
An integration service that ingests and stores model release metadata and generation pricing, directly motivated by the video's recurring complaint that the full Muse Wonder is "unpriced", that Opus clips cost "$11", "$15, nearly 16", and that full-version runs are maybe "five times more expensive" than the non-full one (and Opus "about 20 times more expensive" than the non-full tier). The service exposes release records (variant, reasoning level, open-source flag, published-at) and price records (per-generation cost, currency) over HTTP, backed by SQLAlchemy, and pulls provider catalogues with httpx.

## WHY THIS MATTERS
The reviewer's final caveat is explicit: the full model is only "usable" if it is not so expensive that limits "drain instantly". Cost is half the decision, and it is exactly the data that was missing. Centralising release + pricing facts makes the "should we adopt this model?" question answerable with rows instead of vibes.

## HOW TO BUILD
1. Declare SQLAlchemy models `ModelRelease` and `GenerationPrice` with a foreign key and a uniqueness constraint on `(model_id, captured_at)`.
2. Provide a `fetch_catalog()` httpx client that pulls a provider price page and normalises it.
3. Expose FastAPI routes: `POST /releases`, `POST /prices`, `GET /models/{slug}/pricing`.
4. Upsert on ingest so repeated polls do not duplicate rows.
5. Compute derived multipliers (full vs non-full) in the read handler.

```python
class GenerationPrice(Base):
    __tablename__ = "generation_price"
    id: Mapped[int] = mapped_column(primary_key=True)
    model_id: Mapped[int] = mapped_column(ForeignKey("model_release.id"))
    cost_usd: Mapped[float | None] = mapped_column(nullable=True)  # full = unpriced
    captured_at: Mapped[datetime] = mapped_column(default=datetime.utcnow)

@app.get("/models/{slug}/pricing")
def pricing(slug: str, db: Session = Depends(get_db)) -> dict:
    rows = crud.latest_prices(db, slug)
    return {"slug": slug, "prices": [r.cost_usd for r in rows]}
```

## WHEN TO USE IN PRODUCTION
Use it as the source of truth behind a model-gateway or an internal "approved models" page: budget alerts, cost-per-request ceilings, and release audit trails. Avoid it for real-time token accounting (it stores published prices, not usage) and for models whose pricing is not published — those must stay `NULL`, exactly as the full Muse Wonder does in the video.

## HOW IT HELPS STUDENTS
Students learn relational modelling, foreign keys and upserts, a real httpx integration with retries, and FastAPI dependency injection — the skeleton of any internal platform service.

## STARTER CODE
`starter/main.py` defines both tables, a deterministic seed of the transcript's real records, the httpx poller stub, and the FastAPI routes with TODO markers for auth and migrations.
