INNER CODE UNIT · Python
api_detect_gemini
canarybyte/veridrop · web/server.py:478
async def api_detect_gemini(
request: Request,
base_url: str = Form(...),
api_key: str = Form(...),
model: str = Form(...),
mode: str = Form("standard"),
) -> JSONResponse:
base_url = base_url.strip()
api_key = api_key.strip()
model = model.strip()
mode = mode.strip().lower()
if not base_url.startswith(("http://", "https://")):
raise HTTPException(status_code=400, detail="base_url must start with http(s)://")
if not api_key or len(api_key) < 8:
raise HTTPException(status_code=400, detail="api_key looks invalid")
if not model or len(model) > 200:
raise HTTPException(status_code=400, detail="model must be 1–200 chars")