Coverage for app / routers / spend.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-10-31 11:23 +0000

1"""The deployment's spending ceiling, as operators and svc-core read it.""" 

2 

3from fastapi import APIRouter 

4 

5from app.services import spend_guard 

6 

7router = APIRouter(tags=["spend"]) 

8 

9 

10@router.get("/spend", summary="Model spend today and this month against the ceilings") 

11def spend_status() -> dict: 

12 """What model calls have cost this UTC day and calendar month, each 

13 ceiling, what is left and when it resets (``app.services.spend_guard``). 

14 svc-core's platform benchmark reads it before starting a run, so the 

15 benchmark never spends what people need.""" 

16 return spend_guard.guard().status()