INNER CODE UNIT · Python
api_detect_openai
canarybyte/veridrop · web/server.py:444
async def api_detect_openai(
request: Request,
base_url: str = Form(...),
api_key: str = Form(...),
model: str = Form(...),
mode: str = Form("standard"),
include_long_context: bool = Form(False),
include_long_context_extreme: bool = Form(False),
) -> 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")