INNER CODE UNIT · Python
_preflight_or_422
canarybyte/veridrop · web/server.py:280
async def _preflight_or_422(
request: Request,
base_url: str,
api_key: str,
model: str,
protocol: str,
) -> None:
"""Run model-alive preflight; raise HTTPException 422 with structured
detail if the model is dead so the frontend can offer a one-click swap
to the protocol's recommended model.
Honors the same per-IP probe rate limit. force=true on the request body
skips preflight entirely (escape hatch when relays false-negative on
our 4-token ping).
"""
form = await request.form()
if str(form.get("force") or "").lower() in ("1", "true", "yes"):
return